diff --git a/Cargo.lock b/Cargo.lock index f4e2369..49936d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,7 +231,6 @@ dependencies = [ "hostname", "indicatif", "itertools", - "lazy_static", "libc", "log", "ntest", @@ -607,9 +606,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] diff --git a/Cargo.toml b/Cargo.toml index d1215f2..d358f2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,7 @@ futures = "0.3.28" glob = "0.3.1" hostname = "0.3.1" indicatif = "0.17.3" -itertools = "0.10.5" -lazy_static = "1.4.0" +itertools = "0.11.0" libc = "0.2.144" log = "0.4.17" quit = "2.0.0" @@ -29,8 +28,8 @@ regex = "1" serde = { version = "1.0.163", features = ["derive"] } serde_json = "1.0" shell-escape = "0.1.5" -sys-info = "0.9.1" snafu = { version = "0.7.4", features = ["backtrace", "backtraces-impl-backtrace-crate"] } +sys-info = "0.9.1" tempfile = "3.5.0" tokio-stream = "0.1.14" uuid = { version = "1.3.2", features = ["serde", "v4"] } diff --git a/src/cli.rs b/src/cli.rs index 2741032..c6246bd 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -7,9 +7,8 @@ use clap::{ Command as ClapCommand, ValueEnum, }; use clap_complete::Shell; -use const_format::concatcp; +use const_format::{concatcp, formatcp}; use env_logger::fmt::WriteStyle; -use lazy_static::lazy_static; use crate::command; @@ -34,36 +33,30 @@ const MANUAL_URL: &str = concatcp!( /// API stability cannot be guaranteed for pre-release versions. /// Links to the version currently in development automatically /// leads the user to the unstable manual. -const MANUAL_DISCREPANCY_NOTE: &str = "Note: You are using a pre-release version of Colmena, so the supported options may be different from what's in the manual."; +const MANUAL_DISCREPANCY_NOTE: &str = "\nNote: You are using a pre-release version of Colmena, so the supported options may be different from what's in the manual."; -lazy_static! { - static ref LONG_ABOUT: String = { - let mut message = format!( - r#"NixOS deployment tool +static LONG_ABOUT: &str = formatcp!( + r#"NixOS deployment tool Colmena helps you deploy to multiple hosts running NixOS. For more details, read the manual at <{}>. -"#, - MANUAL_URL - ); +{}"#, + MANUAL_URL, + if !env!("CARGO_PKG_VERSION_PRE").is_empty() { + MANUAL_DISCREPANCY_NOTE + } else { + "" + } +); - if !env!("CARGO_PKG_VERSION_PRE").is_empty() { - message += MANUAL_DISCREPANCY_NOTE; - } - - message - }; - static ref CONFIG_HELP: String = { - format!( - r#"If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly. +static CONFIG_HELP: &str = formatcp!( + r#"If this argument is not specified, Colmena will search upwards from the current working directory for a file named "flake.nix" or "hive.nix". This behavior is disabled if --config/-f is given explicitly. For a sample configuration, check the manual at <{}>. "#, - MANUAL_URL - ) - }; -} + MANUAL_URL +); /// Display order in `--help` for arguments that should be shown first. /// @@ -130,14 +123,14 @@ pub fn build_cli(include_internal: bool) -> ClapCommand { .version(version) .author("Zhaofeng Li ") .about("NixOS deployment tool") - .long_about(LONG_ABOUT.as_str()) + .long_about(LONG_ABOUT) .arg_required_else_help(true) .arg(Arg::new("config") .short('f') .long("config") .value_name("CONFIG") .help("Path to a Hive expression, a flake.nix, or a Nix Flake URI") - .long_help(Some(CONFIG_HELP.as_str())) + .long_help(Some(CONFIG_HELP)) .display_order(HELP_ORDER_FIRST) // The default value is a lie (sort of)!