Remove lazy-static

This commit is contained in:
i1i1 2023-10-18 15:41:54 -06:00 committed by Zhaofeng Li
parent 8d92dadb32
commit 197010c492
3 changed files with 22 additions and 31 deletions

5
Cargo.lock generated
View file

@ -231,7 +231,6 @@ dependencies = [
"hostname", "hostname",
"indicatif", "indicatif",
"itertools", "itertools",
"lazy_static",
"libc", "libc",
"log", "log",
"ntest", "ntest",
@ -607,9 +606,9 @@ dependencies = [
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.10.5" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
dependencies = [ dependencies = [
"either", "either",
] ]

View file

@ -20,8 +20,7 @@ futures = "0.3.28"
glob = "0.3.1" glob = "0.3.1"
hostname = "0.3.1" hostname = "0.3.1"
indicatif = "0.17.3" indicatif = "0.17.3"
itertools = "0.10.5" itertools = "0.11.0"
lazy_static = "1.4.0"
libc = "0.2.144" libc = "0.2.144"
log = "0.4.17" log = "0.4.17"
quit = "2.0.0" quit = "2.0.0"
@ -29,8 +28,8 @@ regex = "1"
serde = { version = "1.0.163", features = ["derive"] } serde = { version = "1.0.163", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
shell-escape = "0.1.5" shell-escape = "0.1.5"
sys-info = "0.9.1"
snafu = { version = "0.7.4", features = ["backtrace", "backtraces-impl-backtrace-crate"] } snafu = { version = "0.7.4", features = ["backtrace", "backtraces-impl-backtrace-crate"] }
sys-info = "0.9.1"
tempfile = "3.5.0" tempfile = "3.5.0"
tokio-stream = "0.1.14" tokio-stream = "0.1.14"
uuid = { version = "1.3.2", features = ["serde", "v4"] } uuid = { version = "1.3.2", features = ["serde", "v4"] }

View file

@ -7,9 +7,8 @@ use clap::{
Command as ClapCommand, ValueEnum, Command as ClapCommand, ValueEnum,
}; };
use clap_complete::Shell; use clap_complete::Shell;
use const_format::concatcp; use const_format::{concatcp, formatcp};
use env_logger::fmt::WriteStyle; use env_logger::fmt::WriteStyle;
use lazy_static::lazy_static;
use crate::command; use crate::command;
@ -34,36 +33,30 @@ const MANUAL_URL: &str = concatcp!(
/// API stability cannot be guaranteed for pre-release versions. /// API stability cannot be guaranteed for pre-release versions.
/// Links to the version currently in development automatically /// Links to the version currently in development automatically
/// leads the user to the unstable manual. /// 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 LONG_ABOUT: &str = formatcp!(
static ref LONG_ABOUT: String = {
let mut message = format!(
r#"NixOS deployment tool r#"NixOS deployment tool
Colmena helps you deploy to multiple hosts running NixOS. Colmena helps you deploy to multiple hosts running NixOS.
For more details, read the manual at <{}>. 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() { static CONFIG_HELP: &str = formatcp!(
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. 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 <{}>. For a sample configuration, check the manual at <{}>.
"#, "#,
MANUAL_URL MANUAL_URL
) );
};
}
/// Display order in `--help` for arguments that should be shown first. /// 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) .version(version)
.author("Zhaofeng Li <hello@zhaofeng.li>") .author("Zhaofeng Li <hello@zhaofeng.li>")
.about("NixOS deployment tool") .about("NixOS deployment tool")
.long_about(LONG_ABOUT.as_str()) .long_about(LONG_ABOUT)
.arg_required_else_help(true) .arg_required_else_help(true)
.arg(Arg::new("config") .arg(Arg::new("config")
.short('f') .short('f')
.long("config") .long("config")
.value_name("CONFIG") .value_name("CONFIG")
.help("Path to a Hive expression, a flake.nix, or a Nix Flake URI") .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) .display_order(HELP_ORDER_FIRST)
// The default value is a lie (sort of)! // The default value is a lie (sort of)!