Cosmetic tweaks to the help messages

This commit is contained in:
Zahary Karadjov 2019-03-26 10:55:27 +02:00
parent 510a883594
commit 5ee45828fa
1 changed files with 9 additions and 5 deletions

View File

@ -53,7 +53,7 @@ proc describeCmdOptions(cmd: CommandDesc) =
write "\n" write "\n"
proc showHelp(version: string, cmd: CommandDesc) = proc showHelp(version: string, cmd: CommandDesc) =
let app = appName & " " & version let app = appName
write "Usage: ", styleBright, app write "Usage: ", styleBright, app
if cmd.name.len > 0: write " ", cmd.name if cmd.name.len > 0: write " ", cmd.name
@ -65,11 +65,15 @@ proc showHelp(version: string, cmd: CommandDesc) =
write "\n\nThe following options are supported:\n\n" write "\n\nThe following options are supported:\n\n"
describeCmdOptions(cmd) describeCmdOptions(cmd)
if cmd.defaultSubCommand != -1:
describeCmdOptions(cmd.subCommands[cmd.defaultSubCommand])
if cmd.subCommands.len > 0: if cmd.subCommands.len > 0:
write "\nAvailable sub-commands:\n\n" write "\nAvailable sub-commands:\n"
for subcmd in cmd.subCommands: for i in 0 ..< cmd.subCommands.len:
write " ", styleBright, app, " ", subcmd.name, "\n\n" if i != cmd.defaultSubCommand:
describeCmdOptions(subcmd) write "\n ", styleBright, app, " ", cmd.subCommands[i].name, "\n\n"
describeCmdOptions(cmd.subCommands[i])
write "\n" write "\n"
quit(0) quit(0)