Skip to content

Feature/argument arg explicit#1567

Merged
shadowspawn merged 4 commits intotj:developfrom
shadowspawn:feature/argument-arg-explicit
Jul 12, 2021
Merged

Feature/argument arg explicit#1567
shadowspawn merged 4 commits intotj:developfrom
shadowspawn:feature/argument-arg-explicit

Conversation

@shadowspawn
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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