Skip to content

Commit

Permalink
Merge pull request #17 from rsteube/fix-repeatable
Browse files Browse the repository at this point in the history
fix repeatable
  • Loading branch information
rsteube authored Oct 23, 2022
2 parents 7128156 + 7d8a524 commit c6d7dbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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
```
```
2 changes: 1 addition & 1 deletion src/carapace_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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("*");
}

Expand Down

0 comments on commit c6d7dbc

Please sign in to comment.