mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
fix(usage): Don't list --
as optional for last
`last` must always follow a `--`, so it isn't optional.
This commit is contained in:
parent
d791a93ec7
commit
a00cbab1dc
2 changed files with 2 additions and 4 deletions
|
@ -102,10 +102,8 @@ impl<'cmd> Usage<'cmd> {
|
||||||
pos.get_id()
|
pos.get_id()
|
||||||
);
|
);
|
||||||
let req = pos.is_required_set();
|
let req = pos.is_required_set();
|
||||||
if req && self.cmd.get_positionals().any(|p| !p.is_required_set()) {
|
if req {
|
||||||
styled.literal(" -- ");
|
styled.literal(" -- ");
|
||||||
} else if req {
|
|
||||||
styled.placeholder(" [--] ");
|
|
||||||
} else {
|
} else {
|
||||||
styled.placeholder(" [-- ");
|
styled.placeholder(" [-- ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ fn req_last_arg_usage() {
|
||||||
static LAST_ARG_REQ_MULT: &str = "example 1.0
|
static LAST_ARG_REQ_MULT: &str = "example 1.0
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
example <FIRST>... [--] <SECOND>...
|
example <FIRST>... -- <SECOND>...
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
<FIRST>... First
|
<FIRST>... First
|
||||||
|
|
Loading…
Reference in a new issue