From 2014b401956f9bdcc43b142ea7a93df69fa7872c Mon Sep 17 00:00:00 2001 From: Serg Tereshchenko Date: Fri, 10 Dec 2021 17:18:57 +0200 Subject: [PATCH] fix: Add files_to_open, removed in https://github.com/neovide/neovide/pull/1016/ --- src/bridge/mod.rs | 3 ++- src/cmd_line.rs | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/bridge/mod.rs b/src/bridge/mod.rs index ca61906..d5163ff 100644 --- a/src/bridge/mod.rs +++ b/src/bridge/mod.rs @@ -124,7 +124,8 @@ pub fn create_nvim_command() -> Command { let mut cmd = build_nvim_cmd(); cmd.arg("--embed") - .args(SETTINGS.get::().neovim_args.iter()); + .args(SETTINGS.get::().neovim_args.iter()) + .args(SETTINGS.get::().files_to_open.iter()); info!("Starting neovim with: {:?}", cmd); diff --git a/src/cmd_line.rs b/src/cmd_line.rs index bb0c889..034a493 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -7,6 +7,7 @@ use clap::{App, Arg}; pub struct CmdLineSettings { // Pass through arguments pub neovim_args: Vec, + pub files_to_open: Vec, // Command-line arguments only pub geometry: Dimensions, pub verbosity: u64, @@ -31,6 +32,7 @@ impl Default for CmdLineSettings { Self { // Pass through arguments neovim_args: vec![], + files_to_open: vec![], // Command-line arguments only geometry: DEFAULT_WINDOW_GEOMETRY, verbosity: 0, @@ -58,6 +60,12 @@ pub fn handle_command_line_arguments(args: Vec) -> Result<(), String> { .author(crate_authors!()) .about(crate_description!()) // Pass through arguments + .arg( + Arg::with_name("files_to_open") + .multiple(true) + .takes_value(true) + .help("Files to open"), + ) .arg( Arg::with_name("neovim_args") .multiple(true) @@ -66,7 +74,12 @@ pub fn handle_command_line_arguments(args: Vec) -> Result<(), String> { .help("Specify Arguments to pass down to neovim"), ) // Command-line arguments only - .arg(Arg::with_name("verbosity").short("v")) + .arg( + Arg::with_name("verbosity") + .short("v") + .multiple(true) + .help("Increase verbosity level (repeatable up to 4 times; implies --nofork)"), + ) .arg( Arg::with_name("geometry") .long("geometry") @@ -151,6 +164,10 @@ pub fn handle_command_line_arguments(args: Vec) -> Result<(), String> { .values_of("neovim_args") .map(|opt| opt.map(|v| v.to_owned()).collect()) .unwrap_or_default(), + files_to_open: matches + .values_of("files_to_open") + .map(|opt| opt.map(|v| v.to_owned()).collect()) + .unwrap_or_default(), // Command-line arguments only verbosity: matches.occurrences_of("verbosity"), geometry: parse_window_geometry(matches.value_of("geometry").map(|i| i.to_owned()))?,