2013-12-23 19:43:54 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-01-27 23:25:14 +00:00
|
|
|
flag "github.com/dotcloud/docker/pkg/mflag"
|
2013-12-23 19:43:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
i int
|
|
|
|
str string
|
|
|
|
b, h bool
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
flag.BoolVar(&b, []string{"b"}, false, "a simple bool")
|
|
|
|
flag.IntVar(&i, []string{"#integer", "-integer"}, -1, "a simple integer")
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
fmt.Printf("%s\n", str)
|
|
|
|
fmt.Printf("%s\n", flag.Lookup("s").Value.String())
|
|
|
|
}
|