File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -334,7 +334,11 @@ func (p *Parser) WriteHelp(writer io.Writer) {
334
334
}
335
335
336
336
if ! allcmd .ArgsRequired {
337
- fmt .Fprintf (wr , "[%s]" , name )
337
+ if arg .Required > 0 {
338
+ fmt .Fprintf (wr , "%s" , name )
339
+ } else {
340
+ fmt .Fprintf (wr , "[%s]" , name )
341
+ }
338
342
} else {
339
343
fmt .Fprintf (wr , "%s" , name )
340
344
}
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ func TestHelp(t *testing.T) {
107
107
108
108
if runtime .GOOS == "windows" {
109
109
expected = `Usage:
110
- TestHelp [OPTIONS] [filename] [num] [ hidden-in-help] <bommand | command | parent>
110
+ TestHelp [OPTIONS] [filename] [num] hidden-in-help <bommand | command | parent>
111
111
112
112
Application Options:
113
113
/v, /verbose Show verbose debug information
@@ -156,7 +156,7 @@ Available commands:
156
156
`
157
157
} else {
158
158
expected = `Usage:
159
- TestHelp [OPTIONS] [filename] [num] [ hidden-in-help] <bommand | command | parent>
159
+ TestHelp [OPTIONS] [filename] [num] hidden-in-help <bommand | command | parent>
160
160
161
161
Application Options:
162
162
-v, --verbose Show verbose debug information
You can’t perform that action at this time.
0 commit comments