@@ -83,6 +83,34 @@ pub fn (cmd &Command) str() string {
83
83
res << ' flags: ${cmd.flags} '
84
84
res << ' required_args: ${cmd.required_args} '
85
85
res << ' args: ${cmd.args} '
86
+ res << ' posix_mode: ${cmd.posix_mode} '
87
+ match cmd.defaults.help {
88
+ bool {
89
+ res << ' defaults.help: ${cmd.defaults.help} '
90
+ }
91
+ CommandFlag {
92
+ res << ' defaults.help.command: ${cmd.defaults.help.command} '
93
+ res << ' defaults.help.flag: ${cmd.defaults.help.flag} '
94
+ }
95
+ }
96
+ match cmd.defaults.man {
97
+ bool {
98
+ res << ' defaults.man: ${cmd.defaults.man} '
99
+ }
100
+ CommandFlag {
101
+ res << ' defaults.man.command: ${cmd.defaults.man.command} '
102
+ res << ' defaults.man.flag: ${cmd.defaults.man.flag} '
103
+ }
104
+ }
105
+ match cmd.defaults.version {
106
+ bool {
107
+ res << ' defaults.version: ${cmd.defaults.version} '
108
+ }
109
+ CommandFlag {
110
+ res << ' defaults.version.command: ${cmd.defaults.version.command} '
111
+ res << ' defaults.version.flag: ${cmd.defaults.version.flag} '
112
+ }
113
+ }
86
114
res << '}'
87
115
return res.join ('\n ' )
88
116
}
@@ -217,7 +245,7 @@ pub fn (mut cmd Command) parse(args []string) {
217
245
cmd.parse_commands ()
218
246
}
219
247
220
- // add_default_flags adds the commonly used `-h`/`--help` and
248
+ // add_default_flags adds the commonly used `-h`/`--help`, `--man`, and
221
249
// `-v`/`--version` flags to the `Command`.
222
250
fn (mut cmd Command) add_default_flags () {
223
251
if cmd.defaults.parsed.help.flag && ! cmd.flags.contains ('help' ) {
@@ -233,8 +261,8 @@ fn (mut cmd Command) add_default_flags() {
233
261
}
234
262
}
235
263
236
- // add_default_commands adds the command functions of the
237
- // commonly used `help` and `version` flags to the `Command`.
264
+ // add_default_commands adds the command functions of the commonly
265
+ // used `help`, `man`, and `version` subcommands to the `Command`.
238
266
fn (mut cmd Command) add_default_commands () {
239
267
if cmd.defaults.parsed.help.command && ! cmd.commands.contains ('help' ) && cmd.is_root () {
240
268
cmd.add_command (help_cmd ())
@@ -369,7 +397,7 @@ pub fn (cmd &Command) execute_help() {
369
397
print (cmd.help_message ())
370
398
}
371
399
372
- // execute_help executes the callback registered
400
+ // execute_man executes the callback registered
373
401
// for the `-man` flag option.
374
402
pub fn (cmd &Command) execute_man () {
375
403
if cmd.commands.contains ('man' ) {
0 commit comments