Browse code

update godoc and add MAINTAINERS for mflags

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)

Victor Vieux authored on 2014/03/15 02:35:41
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+Victor Vieux <victor.vieux@docker.com> (@vieux)
... ...
@@ -10,7 +10,7 @@
10 10
 	Define flags using flag.String(), Bool(), Int(), etc.
11 11
 
12 12
 	This declares an integer flag, -f or --flagname, stored in the pointer ip, with type *int.
13
-		import "flag"
13
+		import "flag /github.com/dotcloud/docker/pkg/mflag"
14 14
 		var ip = flag.Int([]string{"f", "-flagname"}, 1234, "help message for flagname")
15 15
 	If you like, you can bind the flag to a variable using the Var() functions.
16 16
 		var flagvar int
... ...
@@ -23,6 +23,18 @@
23 23
 		flag.Var(&flagVal, []string{"name"}, "help message for flagname")
24 24
 	For such flags, the default value is just the initial value of the variable.
25 25
 
26
+	You can also add "deprecated" flags, they are still usable, bur are not shown
27
+	in the usage and will display a warning when you try to use them:
28
+		var ip = flag.Int([]string{"f", "#flagname", "-flagname"}, 1234, "help message for flagname")
29
+	this will display: `Warning: '-flagname' is deprecated, it will be replaced by '--flagname' soon. See usage.` and
30
+		var ip = flag.Int([]string{"f", "#flagname"}, 1234, "help message for flagname")
31
+	will display: `Warning: '-t' is deprecated, it will be removed soon. See usage.`
32
+
33
+	You can also group one letter flags, bif you declare
34
+		var v = flag.Bool([]string{"v", "-verbose"}, false, "help message for verbose")
35
+		var s = flag.Bool([]string{"s", "-slow"}, false, "help message for slow")
36
+	you will be able to use the -vs or -sv
37
+
26 38
 	After all flags are defined, call
27 39
 		flag.Parse()
28 40
 	to parse the command line into the defined flags.