fix(usage): Don't list -- as optional for last

`last` must always follow a `--`, so it isn't optional.
This commit is contained in:
Ed Page 2022-08-30 15:41:35 -05:00
parent d791a93ec7
commit a00cbab1dc
2 changed files with 2 additions and 4 deletions

View file

@ -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(" [-- ");
} }

View file

@ -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