Skip to content

Commit

Permalink
Fix(cli): Hide error for argument of help
Browse files Browse the repository at this point in the history
The previous commit means that if the user wrote:
  `canonical_data_syncer help`

The program printed:
  Error: invalid argument: 'help'

and then showed the help message. This commit hides that error, so that
only the help message is shown for this special case.

See: exercism#35
  • Loading branch information
ee7 committed Oct 9, 2020
1 parent ae226be commit e0bbcb6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ proc parseArguments*: Arguments =
else:
showError(&"invalid option: '{kind.prefix}{key}'")
of cmdArgument:
case key.toLowerAscii
of HelpArgument.long:
showHelp()
else:
showError(&"invalid argument: '{key}'")
of cmdEnd:
discard

0 comments on commit e0bbcb6

Please sign in to comment.