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

Support argument processing without action handler #1529



Copy link

@shadowspawn shadowspawn commented May 25, 2021

Pull Request


The new processing of arguments is also useful in a single command program without an action handler, but
argument defaults and custom processing and choices were only being applied if there was an action handler.

Prompted by realising .choices() would not work without action handler.


Refactor and process command-arguments whether or not action handler.

When adding the functionality in #1508 I had decided that I preferred not to modify this.args with processed results.
Save processed arguments as this.processedArgs so accessible for simple program without action handler, and from the new hook support too.

This PR includes some minor other improvements:

  • added .arg to Command constructor
  • initialise .arg to empty array (matches existing TypeScript declaration)
  • add JSDoc types for some key Command properties


  • Changed: Command property .arg initialised to empty array (was previously undefined)

@shadowspawn shadowspawn marked this pull request as ready for review May 27, 2021
@shadowspawn shadowspawn added this to the v8.0.0 milestone May 29, 2021
abetomo approved these changes Jun 2, 2021
Copy link

@abetomo abetomo left a comment


Copy link
Collaborator Author

shadowspawn commented Jun 2, 2021

Thanks @abetomo

@shadowspawn shadowspawn merged commit 4663597 into tj:release/8.x Jun 2, 2021
12 checks passed
@shadowspawn shadowspawn deleted the feature/arguments-without-action-2 branch Jun 2, 2021
@shadowspawn shadowspawn added the pending release label Jun 2, 2021
@shadowspawn shadowspawn removed the pending release label Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants