File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ func (in InputInfo) Long(name string) InputInfo {
274274 return in
275275}
276276
277+ // Help sets the brief help blurb for this option or positional argument.
277278func (in InputInfo ) Help (blurb string ) InputInfo {
278279 in .HelpBlurb = blurb
279280 return in
Original file line number Diff line number Diff line change @@ -40,6 +40,24 @@ func ExampleInputInfo_ShortOnly() {
4040 // unknown option '--flag'
4141}
4242
43+ func ExampleInputInfo_Help () {
44+ in := cli .New ("example" ).
45+ Help ("example program" ).
46+ Opt (cli .NewOpt ("aa" ).Help ("a short one or two sentence blurb" ))
47+
48+ _ , err := in .ParseThese ("-h" )
49+ fmt .Println (err )
50+ // Output:
51+ // example - example program
52+ //
53+ // usage:
54+ // example [options]
55+ //
56+ // options:
57+ // --aa <arg> a short one or two sentence blurb
58+ // -h, --help Show this help message and exit.
59+ }
60+
4361func ExampleInputInfo_WithValueName_option () {
4462 in := cli .New ("example" ).
4563 Help ("example program" ).
You can’t perform that action at this time.
0 commit comments