Skip to content

Show full help when the user leaves off all arguments #134

@natecook1000

Description

@natecook1000

When running a command-line tool, if the user doesn't specify any inputs at all it's a good bet that they aren't familiar with the command. If there are required arguments/options/flags, we should show the error message with the full help screen instead of just the abbreviated usage.

For example, if you run the example repeat command with no inputs, you get this:

$ swift run repeat
Error: Missing expected argument '<phrase>'
Usage: repeat [--count <count>] [--include-counter] <phrase>

Instead, it would be great to show this:

$ swift run repeat
Error: Missing expected argument '<phrase>'

USAGE: repeat [--count <count>] [--include-counter] <phrase>

ARGUMENTS:
  <phrase>                The phrase to repeat. 

OPTIONS:
  --count <count>         The number of times to repeat 'phrase'. 
  --include-counter       Include a counter with each repetition. 
  -h, --help              Show help information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions