Add search for nvim in PATH (#279)

* add search for nvim

* need suggestions for error message
macos-click-through
j4qfrost 5 years ago committed by GitHub
parent ede0fb10f5
commit b7b4e95ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

39
Cargo.lock generated

@ -129,6 +129,28 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
[[package]]
name = "backtrace"
version = "0.3.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e"
dependencies = [
"backtrace-sys",
"cfg-if",
"libc",
"rustc-demangle",
]
[[package]]
name = "backtrace-sys"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18fbebbe1c9d1f383a9cc7e8ccdb471b91c8d024ee9c2ca5b5346121fe8b4399"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.11.0" version = "0.11.0"
@ -652,6 +674,15 @@ dependencies = [
"pkg-config", "pkg-config",
] ]
[[package]]
name = "failure"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
dependencies = [
"backtrace",
]
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.9" version = "0.2.9"
@ -1309,6 +1340,7 @@ dependencies = [
"skulpin", "skulpin",
"tokio", "tokio",
"unicode-segmentation", "unicode-segmentation",
"which",
"winapi 0.3.8", "winapi 0.3.8",
"winres", "winres",
] ]
@ -1843,6 +1875,12 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "rustc-demangle"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"
version = "1.1.0" version = "1.1.0"
@ -2468,6 +2506,7 @@ version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
dependencies = [ dependencies = [
"failure",
"libc", "libc",
] ]

@ -30,6 +30,7 @@ flexi_logger = { version = "0.14.6", default-features = false }
anyhow = "1.0.26" anyhow = "1.0.26"
parking_lot="0.10.0" parking_lot="0.10.0"
cfg-if = "0.1.10" cfg-if = "0.1.10"
which = "3.1"
[dev-dependencies] [dev-dependencies]
mockall = "0.7.0" mockall = "0.7.0"

@ -65,10 +65,13 @@ fn platform_build_nvim_cmd(bin: &str) -> Command {
} }
fn build_nvim_cmd() -> Command { fn build_nvim_cmd() -> Command {
let key = "NEOVIM_BIN"; if let Some(path) = std::env::var_os("NEOVIM_BIN") {
match std::env::var_os(key) { platform_build_nvim_cmd(&path.to_string_lossy())
Some(path) => platform_build_nvim_cmd(&path.to_string_lossy()), } else if let Ok(path) = which::which("nvim") {
None => platform_build_nvim_cmd("nvim"), platform_build_nvim_cmd(path.to_str().unwrap())
} else {
error!("nvim not found!");
std::process::exit(1);
} }
} }

Loading…
Cancel
Save