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

Error when command has no script and missing subcommand #27

Merged
merged 3 commits into from
Jul 29, 2019

Conversation

jacobdeichert
Copy link
Owner

Describe the problem

When a parent command has no script source but it has subcommands, mask gracefully exited with no warning or error (nothing happened). If a parent command doesn't have a source, it should be required to have a subcommand or else an error should show.

Describe the solution

I used clap's SubcommandRequired setting for the root command and for all subcommands that have no source but have children commands. Clap now shows a proper "missing command" error and a tip to try --help.

Also found out about this setting VersionlessSubcommands which I've also enabled. Subcommands don't need a version flag. The root command now is the only command with a version flag.
mask --version

How to test

  • Added unit tests
  • Added integration tests

Types of changes

  • Bug fix
  • New feature
  • Breaking change

@jacobdeichert jacobdeichert merged commit 12b600e into master Jul 29, 2019
@jacobdeichert jacobdeichert deleted the error-when-no-script-and-missing-subcommand branch April 4, 2020 15:26
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.

1 participant