Skip to content

Releases: nihaals/clap-complete-command

v0.6.1

14 Jul 15:56
a61c45d
Compare
Choose a tag to compare

v0.6.0

14 Jul 15:52
a9c019d
Compare
Choose a tag to compare
  • Removed fig from default features
  • Updated generator dependencies

Full Changelog: v0.5.1...v0.6.0

v0.5.1

10 Mar 01:28
v0.5.1
c8dff0b
Compare
Choose a tag to compare

Full Changelog: v0.5.0...v0.5.1

v0.5.0

10 Mar 01:08
v0.5.0
6bb519e
Compare
Choose a tag to compare

Additions

  • Add Nushell behind nushell feature (enabled by default)
  • Add Carapace spec generation behind carapace feature

Changes

  • Move Fig behind fig feature (enabled by default)

Full Changelog: v0.4.0...v0.5.0

v0.4.0

04 Oct 23:18
v0.4.0
17e547d
Compare
Choose a tag to compare

Additions

  • Implement ValueEnum
  • Implement Debug

Breaking changes

  • Update Clap to v4
  • Remove implementation of ArgEnum
  • Remove methods for pre-ValueEnum builder API
    • Remove FromStr implementation
    • Remove Shell::possible_values()

Migration guide

See the examples diff, including changes needed to update from Clap v3 to v4:

Builder

--- 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`")
         }
     }
 }

Derive

--- 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

v0.3.4

29 May 12:53
v0.3.4
2226988
Compare
Choose a tag to compare

Full Changelog: v0.3.3...v0.3.4

v0.3.3

26 Apr 20:49
v0.3.3
8414f17
Compare
Choose a tag to compare

Full Changelog: v0.3.2...v0.3.3

v0.3.2

25 Apr 00:14
v0.3.2
6df7a56
Compare
Choose a tag to compare

Full Changelog: v0.3.1...v0.3.2

v0.3.1

23 Apr 01:45
v0.3.1
b71f084
Compare
Choose a tag to compare

Full Changelog: v0.3.0...v0.3.1

v0.3.0

07 Apr 01:06
db27599
Compare
Choose a tag to compare

Full Changelog: v0.2.2...v0.3.0