Customization in Swift ArgumentParser's help command and error output

Hello I want to implement customisation to swift argumentparser, Here are following changes want to do it in my cli

  1. changing default footer present in help command output

currently help command output coming like this

OVERVIEW: clisample

USAGE: clisample <subcommand>

OPTIONS:
  --version               show the version.
  -h, --help              show the help.

SUBCOMMANDS:
  logs (default)          Export logs for clisample processes.
 
See 'clisample --help' for more information.'

so instead of

See 'clisample --help' for more information.'

I want my own string

For more details, run 'clisample help <subcommand>'
  1. customise error string getting from validation error
Error: Missing value for '-t <time>'
Help:  -t <time>  Time window (e.g. 10h, 30m, 2d).
Usage: clisample logs --time <time>

  See 'clisample logs --help' for more information.

so I want error output with example and customised footer, like this

Error: Missing value for '-t <time>'
Help:  -t <time>  Time window (e.g. 10h, 30m, 2d).
Usage: clisample logs --time <time> 
Example: clisample logs -t 5m

  For more details, run 'clisample help <subcommand>'

Is this changes possible from anyway?

Answered by DTS Engineer in 857912022

I generally recommend that you direct questions about the Swift open source effort to Swift Forums. And lo! it seems that you’ve already done that, and got some useful response.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I generally recommend that you direct questions about the Swift open source effort to Swift Forums. And lo! it seems that you’ve already done that, and got some useful response.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Customization in Swift ArgumentParser's help command and error output
 
 
Q