From 5630d5240e51d79048e301b380d8c66083f6ced2 Mon Sep 17 00:00:00 2001 From: LoipesMas <46327403+LoipesMas@users.noreply.github.com> Date: Mon, 11 Oct 2021 20:49:35 +0200 Subject: [PATCH] Add neovim_bin argument --- src/cmd_line.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cmd_line.rs b/src/cmd_line.rs index e9c5255..df59afe 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -117,6 +117,12 @@ pub fn handle_command_line_arguments() -> Result<(), String> { .takes_value(true) .help("Files to open"), ) + .arg( + Arg::with_name("neovim_bin") + .long("neovim-bin") + .takes_value(true) + .help("Specify path to neovim"), + ) .arg( Arg::with_name("neovim_args") .multiple(true) @@ -150,7 +156,10 @@ pub fn handle_command_line_arguments() -> Result<(), String> { .values_of("neovim_args") .map(|opt| opt.map(|v| v.to_owned()).collect()) .unwrap_or_default(), - neovim_bin: std::env::var("NEOVIM_BIN").ok(), + neovim_bin: match std::env::var("NEOVIM_BIN") { + Ok(val) => Some(val), + Err(_) => matches.value_of("neovim_bin").map(|b| b.to_string()), + }, files_to_open: matches .values_of("files") .map(|opt| opt.map(|v| v.to_owned()).collect())