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

Feature/argument arg explicit #1567

Merged
merged 4 commits into from
Jul 12, 2021

Conversation

shadowspawn
Copy link
Collaborator

Pull Request

Fill out the Argument methods to allow explicit configuration of required/optional with a fluent method. This is an alternative to implicit syntax using brackets in name string.

Related: #1359 (comment)

Problem

The syntax for required (<arg>) and optional ([arg]) command-arguments needs to be learned. (However, this is consistent with the syntax shown in the help so is actually useful to learn!)

Solution

Offer an explicit method to set whether option is required or optional.

program.addArgument(new Argument('foo').argRequired());
program.addArgument(new Argument('bar').argOptional());

The method naming is intended to be the same for adding matching methods to Option in future.

ChangeLog

  • add Argument methods for .argRequired() and .argOptional().

Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Jul 12, 2021
@shadowspawn shadowspawn merged commit 6f51e4a into tj:develop Jul 12, 2021
@shadowspawn shadowspawn deleted the feature/argument-arg-explicit branch July 12, 2021 00:05
@shadowspawn
Copy link
Collaborator Author

Released in Commander v8.1

@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants