From a00cbab1dcc1b30aa467fdfdc635a18a951fc4e8 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 30 Aug 2022 15:41:35 -0500 Subject: [PATCH] fix(usage): Don't list `--` as optional for `last` `last` must always follow a `--`, so it isn't optional. --- src/output/usage.rs | 4 +--- tests/builder/help.rs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/output/usage.rs b/src/output/usage.rs index 2452c694..264316fb 100644 --- a/src/output/usage.rs +++ b/src/output/usage.rs @@ -102,10 +102,8 @@ impl<'cmd> Usage<'cmd> { pos.get_id() ); let req = pos.is_required_set(); - if req && self.cmd.get_positionals().any(|p| !p.is_required_set()) { + if req { styled.literal(" -- "); - } else if req { - styled.placeholder(" [--] "); } else { styled.placeholder(" [-- "); } diff --git a/tests/builder/help.rs b/tests/builder/help.rs index efb51c05..49631a44 100644 --- a/tests/builder/help.rs +++ b/tests/builder/help.rs @@ -91,7 +91,7 @@ fn req_last_arg_usage() { static LAST_ARG_REQ_MULT: &str = "example 1.0 Usage: - example ... [--] ... + example ... -- ... Arguments: ... First