Simplistic "Command not found" error message

This commit is contained in:
Marie Katrine Ekeberg 2022-09-11 20:11:53 +02:00 committed by David Peter
parent cbc6ddeefc
commit c7370ca82c
3 changed files with 13 additions and 47 deletions

56
Cargo.lock generated
View File

@ -28,13 +28,13 @@ checksum = "c91f1f46651137be86f3a2b9a8359f9ab421d04d941c62b5982e1ca21113adf9"
[[package]]
name = "argmax"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "932fb17af6e53a41ce7312f1ae1ba2a6f3f613fe36f38ad655b212906eb9657f"
checksum = "5b7e3ef5e3a7f2c5e5a49d90ad087c03d38258e75155daac64deb62c50972c66"
dependencies = [
"lazy_static",
"libc",
"nix 0.23.1",
"nix",
]
[[package]]
@ -141,11 +141,11 @@ dependencies = [
[[package]]
name = "ctrlc"
version = "3.2.3"
version = "3.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d91974fbbe88ec1df0c24a4f00f99583667a7e2e6272b2b92d294d81e462173"
checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865"
dependencies = [
"nix 0.25.0",
"nix",
"winapi",
]
@ -209,7 +209,7 @@ dependencies = [
"jemallocator",
"libc",
"lscolors",
"nix 0.24.2",
"nix",
"normpath",
"num_cpus",
"once_cell",
@ -353,9 +353,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.132"
version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "log"
@ -381,28 +381,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
[[package]]
name = "nix"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.24.2"
@ -414,18 +392,6 @@ dependencies = [
"libc",
]
[[package]]
name = "nix"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb"
dependencies = [
"autocfg",
"bitflags",
"cfg-if",
"libc",
]
[[package]]
name = "normpath"
version = "0.3.2"
@ -466,9 +432,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.13.1"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e"
checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0"
[[package]]
name = "os_str_bytes"

View File

@ -36,7 +36,7 @@ version_check = "0.9"
[dependencies]
ansi_term = "0.12"
argmax = "0.3.0"
argmax = "0.3.1"
atty = "0.2"
ignore = "0.4.3"
num_cpus = "1.13"

View File

@ -96,7 +96,7 @@ pub fn execute_commands<I: Iterator<Item = io::Result<Command>>>(
pub fn handle_cmd_error(cmd: Option<&Command>, err: io::Error) -> ExitCode {
match (cmd, err) {
(Some(cmd), err) if err.kind() == io::ErrorKind::NotFound => {
print_error(format!("Command not found: {:?}", cmd));
print_error(format!("Command not found: {:?}", cmd.get_program()));
ExitCode::GeneralError
}
(_, err) => {