update commands.go
update docker.go move to pkg update docs update name and copyright change --sinceId to --since-id, update completion and docs Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor@docker.com> (github: vieux)
This commit is contained in:
parent
f42ea7d0b7
commit
e15a64d1a2
6 changed files with 1351 additions and 0 deletions
27
mflag/example/example.go
Normal file
27
mflag/example/example.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/dotcloud/docker/pkg/flag"
|
||||
)
|
||||
|
||||
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())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue