Skip to content

Commit

Permalink
change rendering marker of unlimited args
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Oct 8, 2023
1 parent 8042d1a commit 6430195
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ impl FlagOptionParam {
.iter()
.enumerate()
.map(|(i, v)| {
let ellipsis = self.unlimited_args() && i == self.arg_value_names.len() - 1;
let ellipsis = if ellipsis { "" } else { "" };
let unlimited = self.unlimited_args() && i == self.arg_value_names.len() - 1;
let marker = if unlimited { "+" } else { "" };
if self.multi_occurs() {
format!("{v}{ellipsis}")
format!("{v}{marker}")
} else {
format!("<{v}{ellipsis}>")
format!("<{v}{marker}>")
}
})
.collect::<Vec<String>>()
Expand Down
12 changes: 6 additions & 6 deletions tests/snapshots/integration__spec__option_help.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ command cat >&2 <<-'EOF'
USAGE: prog cmdd [OPTIONS]

OPTIONS:
--oa <OA>
--oa <OA+>
-h, --help

EOF
Expand All @@ -88,11 +88,11 @@ command cat >&2 <<-'EOF'
USAGE: prog cmde [OPTIONS]

OPTIONS:
--oa <OA>
--ob <DIR>
--oc <CMD> <DIR>
--od [OD]...
--oe [DIR]...
--oa <OA+>
--ob <DIR+>
--oc <CMD> <DIR+>
--od [OD+]...
--oe [DIR+]...
-h, --help

EOF
Expand Down
6 changes: 3 additions & 3 deletions tests/snapshots/integration__spec__option_multiple.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ USAGE: prog [OPTIONS]
OPTIONS:
-f, --fc...
-a, --oa [DIR]...
-b, --ob <CMD> <DIR>
-c, --oc <DIR>
-b, --ob <CMD> <DIR+>
-c, --oc <DIR+>
-d, --od <DIR> <FILE>
-e, --oe [DIR]...
-e, --oe [DIR+]...
-h, --help

EOF
Expand Down

0 comments on commit 6430195

Please sign in to comment.