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

Allow multiple valid 'accepts' items #174

Open
pbelbin opened this issue Dec 23, 2019 · 0 comments
Open

Allow multiple valid 'accepts' items #174

pbelbin opened this issue Dec 23, 2019 · 0 comments

Comments

@pbelbin
Copy link
Collaborator

pbelbin commented Dec 23, 2019

The current Waterfall CLI (0.3.2) provides a way for the CommandSpec.data.accepts to define a list of acceptable items the user may specify on the input, but, it limits the user to only selecting a single item.

When the CommandSpec.data omits the accepts property, whatever is supplied is passed through to the CLI verb processing code without doing any validation checks at all. This means the client is required to validate, and is responsible for output having a consistent appearance.

It would be nice to have a way to indicate that multiple of the provided accepts items are allowed, so that the validity checks will be done by Waterfall CLI.

This would have a nice benefit in terms of making the usage of the --help more consistent too. When the accepts property is given, Waterfall CLI generates the output to incorporate that list. Not using the accepts means one has to leverage the description property to describe the list of available options, and the output is not quite the same.

eg:

  • Output with accepts undefined:
Peters-MBP:main-stack peterbelbin$ spark test --help
Description: Run tests against some aspect of the project
Usage: spark test [flags] [data]
FLAGS:         
  --version, -v    Show version
  --help, -h       Show help   
DATA:
  What to test: subset of: api, admin, cst, mt (required)
Peters-MBP:main-stack peterbelbin$ 
  • Output with accepts defined:
Peters-MBP:main-stack peterbelbin$ spark test --help
Description: Run tests against some aspect of the project
Usage: spark test [flags] [data]
FLAGS:         
  --version, -v    Show version
  --help, -h       Show help   
DATA:
  What to test: list of testables (required) (accepts: api, admin, cst, mt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants