2013-12-23 14:43:54 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-05-06 13:43:46 -04:00
|
|
|
|
2014-07-24 18:19:50 -04:00
|
|
|
flag "github.com/docker/docker/pkg/mflag"
|
2013-12-23 14:43:54 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2014-01-31 14:33:48 -05:00
|
|
|
i int
|
|
|
|
str string
|
|
|
|
b, b2, h bool
|
2013-12-23 14:43:54 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2014-03-05 14:27:39 -05:00
|
|
|
flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp")
|
2014-03-11 20:51:46 -04:00
|
|
|
flag.BoolVar(&b, []string{"b", "#bal", "#bol", "-bal"}, false, "a simple bool")
|
|
|
|
flag.BoolVar(&b, []string{"g", "#gil"}, false, "a simple bool")
|
2014-03-05 14:45:57 -05:00
|
|
|
flag.BoolVar(&b2, []string{"#-bool"}, false, "a simple bool")
|
|
|
|
flag.IntVar(&i, []string{"-integer", "-number"}, -1, "a simple integer")
|
2013-12-23 14:43:54 -05:00
|
|
|
flag.StringVar(&str, []string{"s", "#hidden", "-string"}, "", "a simple string") //-s -hidden and --string will work, but -hidden won't be in the usage
|
|
|
|
flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help")
|
2014-05-06 13:43:46 -04:00
|
|
|
flag.StringVar(&str, []string{"mode"}, "mode1", "set the mode\nmode1: use the mode1\nmode2: use the mode2\nmode3: use the mode3")
|
2013-12-23 14:43:54 -05:00
|
|
|
flag.Parse()
|
|
|
|
}
|
|
|
|
func main() {
|
|
|
|
if h {
|
|
|
|
flag.PrintDefaults()
|
2014-05-06 13:43:46 -04:00
|
|
|
} else {
|
|
|
|
fmt.Printf("s/#hidden/-string: %s\n", str)
|
2014-06-12 01:15:53 -04:00
|
|
|
fmt.Printf("b: %t\n", b)
|
|
|
|
fmt.Printf("-bool: %t\n", b2)
|
2014-05-06 13:43:46 -04:00
|
|
|
fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String())
|
|
|
|
fmt.Printf("ARGS: %v\n", flag.Args())
|
2013-12-23 14:43:54 -05:00
|
|
|
}
|
|
|
|
}
|