diff --git a/Cargo.lock b/Cargo.lock index a272a17deaf..ebcde41e572 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,9 +130,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" [[package]] name = "memchr" @@ -186,9 +186,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a50b9351bfa8d65a7d93ce712dc63d2fd15ddbf2c36990fc7cac344859c04f" +checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101" dependencies = [ "unicode-xid", ] @@ -268,9 +268,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.23" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b5f192649e48a5302a13f2feb224df883b98933222369e4b3b0fe2a5447269" +checksum = "ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de" dependencies = [ "proc-macro2", "quote", @@ -332,9 +332,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "which" diff --git a/src/dispatch.rs b/src/dispatch.rs index 05e7ad1384e..ac7caa4ff10 100644 --- a/src/dispatch.rs +++ b/src/dispatch.rs @@ -5,10 +5,7 @@ use structopt::StructOpt; /// The command line options to be collected. #[derive(Debug, StructOpt)] -#[structopt( - name = "pacpat-ng", - about = "A pacman-like wrapper for many package managers." -)] +#[structopt(about = "A pacman-like wrapper for many package managers.")] pub struct Opt { // Operations include Q(uery), R(emove), and S(ync). #[structopt(short = "Q", long)] @@ -133,8 +130,9 @@ impl Opt { let no_confirm = self.no_confirm; let force_cask = self.force_cask; - let unknown = Box::new(unknown::Unknown {}); + let unknown = || Box::new(unknown::Unknown {}); + // Windows if cfg!(target_os = "windows") { // Chocolatey if is_exe("choco", "") { @@ -143,9 +141,11 @@ impl Opt { no_confirm, }) } else { - unknown + unknown() } - } else if cfg!(target_os = "macos") { + } + // macOS + else if cfg!(target_os = "macos") { // Homebrew if is_exe("brew", "/usr/local/bin/brew") { Box::new(homebrew::Homebrew { @@ -155,9 +155,11 @@ impl Opt { no_confirm, }) } else { - unknown + unknown() } - } else if cfg!(target_os = "linux") { + } + // Linux + else if cfg!(target_os = "linux") { // Apt/Dpkg for Debian/Ubuntu/Termux if is_exe("apt-get", "/usr/bin/apt-get") { Box::new(dpkg::Dpkg { @@ -172,10 +174,12 @@ impl Opt { no_confirm, }) } else { - unknown + unknown() } - } else { - unknown + } + // Unknown OS + else { + unknown() } }