NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #3322 most downloaded on crates.io
Reduces boilerplate for adding a shell completion command to Clap
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.3 years
Most releases are documented
notes for 10 of 14 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
14 releases · first in 2022
One column per quarter.
Full Changelog : v0.6.0...v0.6.1
Full Changelog: v0.6.0...v0.6.1
Removed fig from default features
fig from default featuresFull Changelog: v0.5.1...v0.6.0
Full Changelog : v0.5.0...v0.5.1
Full Changelog: v0.5.0...v0.5.1
Add Nushell behind nushell feature (enabled by default)
nushell feature (enabled by default)carapace featurefig feature (enabled by default)Full Changelog: v0.4.0...v0.5.0
Remove implementation of ArgEnum
ValueEnumDebugArgEnumValueEnum builder API
FromStr implementationShell::possible_values()See the examples diff, including changes needed to update from Clap v3 to v4:
--- a/examples/builder.rs
+++ b/examples/builder.rs
use clap::{Arg, Command};
-fn build_cli() -> Command<'static> {
+fn build_cli() -> Command {
Command::new(env!("CARGO_PKG_NAME"))
.subcommand_required(true)
.subcommand(
Command::new("completions")
.about("Generate shell completions")
.arg(
Arg::new("shell")
.value_name("SHELL")
.help("The shell to generate the completions for")
.required(true)
- .possible_values(clap_complete_command::Shell::possible_values()),
+ .value_parser(
+ clap::builder::EnumValueParser::<clap_complete_command::Shell>::new(),
+ ),
),
)
}
fn main() {
let matches = build_cli().get_matches();
match matches.subcommand() {
Some(("completions", sub_matches)) => {
- if let Ok(shell) = sub_matches.value_of_t::<clap_complete_command::Shell>("shell") {
+ if let Some(shell) = sub_matches.get_one::<clap_complete_command::Shell>("shell") {
let mut command = build_cli();
shell.generate(&mut command, &mut std::io::stdout());
}
}
_ => {
unreachable!("Exhausted list of subcommands and `subcommand_required` prevents `None`")
}
}
}--- a/examples/derive.rs
+++ b/examples/derive.rs
-use clap::{IntoApp, Parser, Subcommand};
+use clap::{CommandFactory, Parser, Subcommand};
#[derive(Parser)]
struct Cli {
- #[clap(subcommand)]
+ #[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
/// Generate shell completions
Completions {
/// The shell to generate the completions for
- #[clap(arg_enum)]
+ #[arg(value_enum)]
shell: clap_complete_command::Shell,
},
}
fn main() {
let cli = Cli::parse();
match cli.command {
Commands::Completions { shell } => {
shell.generate(&mut Cli::command(), &mut std::io::stdout());
}
}
}Full Changelog: v0.3.4...v0.4.0
Full Changelog : v0.3.3...v0.3.4
Full Changelog: v0.3.3...v0.3.4
Full Changelog : v0.3.2...v0.3.3
Full Changelog: v0.3.2...v0.3.3
Full Changelog : v0.3.1...v0.3.2
Full Changelog: v0.3.1...v0.3.2
Full Changelog : v0.3.0...v0.3.1
Full Changelog: v0.3.0...v0.3.1
Full Changelog : v0.2.2...v0.3.0
Full Changelog: v0.2.2...v0.3.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →