2013-12-23 14:43:54 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-01-27 18:25:14 -05:00
|
|
|
flag "github.com/dotcloud/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")
|
|
|
|
flag.Parse()
|
|
|
|
}
|
|
|
|
func main() {
|
|
|
|
if h {
|
|
|
|
flag.PrintDefaults()
|
|
|
|
}
|
2014-01-31 14:33:48 -05:00
|
|
|
fmt.Printf("s/#hidden/-string: %s\n", str)
|
|
|
|
fmt.Printf("b: %b\n", b)
|
|
|
|
fmt.Printf("-bool: %b\n", b2)
|
|
|
|
fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String())
|
2014-02-18 19:24:32 -05:00
|
|
|
fmt.Printf("ARGS: %v\n", flag.Args())
|
2013-12-23 14:43:54 -05:00
|
|
|
}
|