2013-12-23 19:43:54 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-05-06 17:43:46 +00:00
|
|
|
|
2014-01-27 23:25:14 +00:00
|
|
|
flag "github.com/dotcloud/docker/pkg/mflag"
|
2013-12-23 19:43:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2014-01-31 19:33:48 +00:00
|
|
|
i int
|
|
|
|
str string
|
|
|
|
b, b2, h bool
|
2013-12-23 19:43:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2014-03-05 19:27:39 +00:00
|
|
|
flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp")
|
2014-03-12 00:51:46 +00: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 19:45:57 +00:00
|
|
|
flag.BoolVar(&b2, []string{"#-bool"}, false, "a simple bool")
|
|
|
|
flag.IntVar(&i, []string{"-integer", "-number"}, -1, "a simple integer")
|
2013-12-23 19:43:54 +00: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 17:43:46 +00: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 19:43:54 +00:00
|
|
|
flag.Parse()
|
|
|
|
}
|
|
|
|
func main() {
|
|
|
|
if h {
|
|
|
|
flag.PrintDefaults()
|
2014-05-06 17:43:46 +00:00
|
|
|
} else {
|
|
|
|
fmt.Printf("s/#hidden/-string: %s\n", str)
|
2014-06-12 05:15:53 +00:00
|
|
|
fmt.Printf("b: %t\n", b)
|
|
|
|
fmt.Printf("-bool: %t\n", b2)
|
2014-05-06 17:43:46 +00: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 19:43:54 +00:00
|
|
|
}
|
|
|
|
}
|