google / google/argh

Support for a minimum number of repeated arguments

Open
#110 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
2k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Whether `positional` or `option` arguments that are of type `Vec` are always treated as "0 or more", with no way to specify "one or more", or "two or more".

This is similar to issue #13, but a more general case.

I can make two proposals here:

**Proposal 1:**

add an attribute such as `#[argh(option, required)]`, which forces _some_ value to be present for vec-types.

**Proposal 2:**

add an attribute such as `#[argh(option, required(2+)]` or `#[argh(option, required="2+")]`


Help text would need to be adjusted accordingly as well, such as:
```
Usage: cmdname --option --option [--option ...]

Options:
--option some option (2 or more required)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.