From 7d8a524526b0ae975e8572c20e9797999ed63f3a Mon Sep 17 00:00:00 2001 From: rsteube Date: Sun, 23 Oct 2022 20:12:07 +0200 Subject: [PATCH] fix repeatable --- Cargo.toml | 2 +- README.md | 23 ++++++++++------------- src/carapace_spec.rs | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ffe5cd6..1784c43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "carapace_spec_clap" -description = "spec generation for clap" +description = "spec generation for clap-rs/clap" version = "0.1.0-PLACEHOLDER" edition = "2021" repository = "https://github.com/rsteube/carapace-spec-clap" diff --git a/README.md b/README.md index fcb65ad..19fb24e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Crates.io](https://img.shields.io/crates/v/carapace_spec_clap.svg)](https://crates.io/crates/carapace_spec_clap) -[Spec](https://github.com/rsteube/carapace-spec) generation for [clap](https://github.com/clap-rs/clap) +[Spec](https://github.com/rsteube/carapace-spec) generation for [clap-rs/clap](https://github.com/clap-rs/clap) ```rust use carapace_spec_clap::Spec; @@ -35,16 +35,13 @@ fn main() { .value_parser(["one", "two", "three"]), ) .subcommand( - Command::new("subcommand") - .about("example subcommand") - .arg( - Arg::new("command") + Command::new("subcommand").about("example subcommand").arg( + Arg::new("command") .long("command") .short('c') .help("execute command") .value_hint(ValueHint::CommandName), - ) - + ), ); generate(Spec, &mut cmd, "myapp", &mut io::stdout()); @@ -58,25 +55,25 @@ aliases: - alias2 description: example command flags: - -v=*: takes argument - --optional?*: optional argument -h, --help: show help + --optional?: optional argument + -v=: takes argument completion: flag: + optional: + - $_os.Users v: - one - two - three - optional: - - $_os.Users commands: - name: subcommand description: example subcommand flags: - -c, --command=*: execute command + -c, --command=: execute command completion: flag: command: - $_os.PathExecutables - $files -``` +``` \ No newline at end of file diff --git a/src/carapace_spec.rs b/src/carapace_spec.rs index 9a6ce60..8de4d4d 100644 --- a/src/carapace_spec.rs +++ b/src/carapace_spec.rs @@ -145,7 +145,7 @@ fn modifier_for(option: &Arg) -> String { } } - if let ArgAction::Set | ArgAction::Append | ArgAction::Count = option.get_action() { + if let ArgAction::Append | ArgAction::Count = option.get_action() { modifier.push("*"); }