Exemplo n.º 1
0
func init() {
	flag.BoolVar(&help, []string{"h", "-help"}, false, "Display help")
	flag.BoolVar(&verbose, []string{"v", "-verbose"}, false, "Switch to verbose output")
	flag.Var(&keys, []string{"k", "-key-file"}, "Private key with which to sign")
	flag.Parse()
	if kk := flag.Lookup("-k"); kk != nil {
		keys = *kk.Value.(*opts.ListOpts)
	}
}
Exemplo n.º 2
0
func main() {
	if h {
		flag.PrintDefaults()
	} else {
		fmt.Printf("s/#hidden/-string: %s\n", str)
		fmt.Printf("b: %t\n", b)
		fmt.Printf("-bool: %t\n", b2)
		fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String())
		fmt.Printf("ARGS: %v\n", flag.Args())
	}
}