Skip to content

Conversation

@neurocline
Copy link

@neurocline neurocline commented Apr 6, 2018

Updates NoArgs to also report invalid argument

NoArgs currently reports "unknown command" in all cases, which
can be is a little misleading to the user if there are no
subcommands. Change it as follows

  • if subcommands and one extra arg, say "unknown command"
  • otherwise, say "invalid argument(s)" and show all extra args

This should produce more meaningful error messages to users, and
works for both the root and sub-commands.

@neurocline
Copy link
Author

Of course, I'm now having second thoughts. I think the behavior of NoArgs should be a little more nuanced. If you have no subcommands, it should definitely return "invalid argument". If you have subcommands and you have exactly one extra argument, it should probably say "unknown command", otherwise it would say "invalid arguments".

Also, it should show all the extra arguments, not just the first one.

@neurocline neurocline force-pushed the change-noargs-return branch from a4c71bc to 9b6c785 Compare April 6, 2018 20:09
NoArgs currently reports "unknown command" in all cases, which
can be is a little misleading to the user if there are no
subcommands. Change it as follows

- if subcommands and one extra arg, say "unknown command"
- otherwise, say "invalid argument(s)" and show all extra args

This should produce more meaningful error messages to users, and
works for both the root and sub-commands.
@neurocline neurocline force-pushed the change-noargs-return branch from 9b6c785 to d8e244d Compare April 6, 2018 20:14
@neurocline
Copy link
Author

I updated my pull request with the behavior outlined in the previous message.

@pior
Copy link

pior commented May 20, 2018

👍

@github-actions
Copy link

This PR is being marked as stale due to a long period of inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants