flag: fix the comments
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
4e3563a9b6
commit
16130e775f
1 changed files with 4 additions and 4 deletions
|
@ -23,12 +23,12 @@
|
||||||
flag.Var(&flagVal, []string{"name"}, "help message for flagname")
|
flag.Var(&flagVal, []string{"name"}, "help message for flagname")
|
||||||
For such flags, the default value is just the initial value of the variable.
|
For such flags, the default value is just the initial value of the variable.
|
||||||
|
|
||||||
You can also add "deprecated" flags, they are still usable, bur are not shown
|
You can also add "deprecated" flags, they are still usable, but are not shown
|
||||||
in the usage and will display a warning when you try to use them:
|
in the usage and will display a warning when you try to use them:
|
||||||
var ip = flag.Int([]string{"f", "#flagname", "-flagname"}, 1234, "help message for flagname")
|
var ip = flag.Int([]string{"#f", "#flagname", "-flagname2"}, 1234, "help message for flagname")
|
||||||
this will display: `Warning: '-flagname' is deprecated, it will be replaced by '--flagname' soon. See usage.` and
|
this will display: `Warning: '--flagname' is deprecated, it will be replaced by '--flagname2' soon. See usage.` and
|
||||||
var ip = flag.Int([]string{"f", "#flagname"}, 1234, "help message for flagname")
|
var ip = flag.Int([]string{"f", "#flagname"}, 1234, "help message for flagname")
|
||||||
will display: `Warning: '-t' is deprecated, it will be removed soon. See usage.`
|
will display: `Warning: '-f' is deprecated, it will be removed soon. See usage.`
|
||||||
|
|
||||||
You can also group one letter flags, bif you declare
|
You can also group one letter flags, bif you declare
|
||||||
var v = flag.Bool([]string{"v", "-verbose"}, false, "help message for verbose")
|
var v = flag.Bool([]string{"v", "-verbose"}, false, "help message for verbose")
|
||||||
|
|
Loading…
Reference in a new issue