Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes NoArgs to report invalid argument #666

Closed
wants to merge 1 commit into from

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.

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

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.

None yet

2 participants