SwiftCLI icon indicating copy to clipboard operation
SwiftCLI copied to clipboard

Allow changing newline padding in usage messages

Open msanders opened this issue 5 years ago • 1 comments

It would be nice if there were a way to disable the newline padding in usage and error messages without re-implementing the default implementations in HelpMessageGenerator. I personally think it makes sense to turn it off by default, since that's more consistent with other command line tools. E.g.:


Usage: cli <command> [options]

Commands:
  help              Prints help information
  version           Prints the current version of this app

would become:

Usage: cli <command> [options]

Commands:
  help              Prints help information
  version           Prints the current version of this app

msanders avatar Jan 22 '20 16:01 msanders

I agree that there should be a way to easily change this. The formatting used is based on docker formatting, which does include the newline, so I'm going to leave the newline as the default. To change it would look something like:

cli.helpMessageGenerator = DefaultHelpMessageGenerator(newlineAtMessageStart: false)

Does that sound good?

jakeheis avatar May 01 '20 19:05 jakeheis