diff --git a/Cargo.lock b/Cargo.lock index 854fba18..c59ec412 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -269,9 +269,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.0.14" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63edc3f163b3c71ec8aa23f9bd6070f77edbf3d1d198b164afa90ff00e4ec62" +checksum = "e5f1fea81f183005ced9e59cdb01737ef2423956dac5a6d731b06b2ecfaa3467" dependencies = [ "atty", "bitflags", @@ -296,11 +296,11 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b9752c030a14235a0bd5ef3ad60a1dcac8468c30921327fc8af36b20c790b9" +checksum = "5fd1122e63869df2cb309f449da1ad54a7c6dfeb7c7e6ccd8e0825d9eb93bb72" dependencies = [ - "heck", + "heck 0.4.0", "proc-macro-error", "proc-macro2", "quote", @@ -715,6 +715,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1699,7 +1705,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro2", "quote", "syn", diff --git a/Cargo.toml b/Cargo.toml index e12cb97f..1558e496 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ battery = ["starship-battery"] ansi_term = "0.12.1" byte-unit = "4.0.13" chrono = "0.4.19" -clap = { version = "3.0.14", features = ["derive", "cargo", "unicode"] } +clap = { version = "3.1.0", features = ["derive", "cargo", "unicode"] } clap_complete = "3.0.6" directories-next = "2.0.0" gethostname = "0.2.2" diff --git a/src/main.rs b/src/main.rs index a2dfad57..fd017663 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use clap::crate_authors; use std::io; use std::time::SystemTime; -use clap::{AppSettings, IntoApp, Parser, Subcommand}; +use clap::{IntoApp, Parser, Subcommand}; use clap_complete::{generate, Shell as CompletionShell}; use rand::distributions::Alphanumeric; use rand::Rng; @@ -22,9 +22,10 @@ fn long_version() -> &'static str { author=crate_authors!(), version=shadow::PKG_VERSION, long_version=long_version(), - about="The cross-shell prompt for astronauts. ☄🌌️" + about="The cross-shell prompt for astronauts. ☄🌌️", + subcommand_required=true, + arg_required_else_help=true, )] -#[clap(setting(AppSettings::SubcommandRequiredElseHelp))] struct Cli { #[clap(subcommand)] command: Commands, @@ -88,7 +89,7 @@ enum Commands { /// Generate random session key Session, /// Prints time in milliseconds - #[clap(setting=AppSettings::Hidden)] + #[clap(hide = true)] Time, /// Prints timings of all active modules Timings(Properties), @@ -206,7 +207,7 @@ fn main() { Commands::Timings(props) => print::timings(props), Commands::Completions { shell } => generate( shell, - &mut Cli::into_app(), + &mut Cli::command(), "starship", &mut io::stdout().lock(), ),