macos-click-through
Serg Tereshchenko 3 years ago committed by Keith Simmons
parent 6e93bd7552
commit 2014b40195

@ -124,7 +124,8 @@ pub fn create_nvim_command() -> Command {
let mut cmd = build_nvim_cmd(); let mut cmd = build_nvim_cmd();
cmd.arg("--embed") cmd.arg("--embed")
.args(SETTINGS.get::<CmdLineSettings>().neovim_args.iter()); .args(SETTINGS.get::<CmdLineSettings>().neovim_args.iter())
.args(SETTINGS.get::<CmdLineSettings>().files_to_open.iter());
info!("Starting neovim with: {:?}", cmd); info!("Starting neovim with: {:?}", cmd);

@ -7,6 +7,7 @@ use clap::{App, Arg};
pub struct CmdLineSettings { pub struct CmdLineSettings {
// Pass through arguments // Pass through arguments
pub neovim_args: Vec<String>, pub neovim_args: Vec<String>,
pub files_to_open: Vec<String>,
// Command-line arguments only // Command-line arguments only
pub geometry: Dimensions, pub geometry: Dimensions,
pub verbosity: u64, pub verbosity: u64,
@ -31,6 +32,7 @@ impl Default for CmdLineSettings {
Self { Self {
// Pass through arguments // Pass through arguments
neovim_args: vec![], neovim_args: vec![],
files_to_open: vec![],
// Command-line arguments only // Command-line arguments only
geometry: DEFAULT_WINDOW_GEOMETRY, geometry: DEFAULT_WINDOW_GEOMETRY,
verbosity: 0, verbosity: 0,
@ -58,6 +60,12 @@ pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
// Pass through arguments // Pass through arguments
.arg(
Arg::with_name("files_to_open")
.multiple(true)
.takes_value(true)
.help("Files to open"),
)
.arg( .arg(
Arg::with_name("neovim_args") Arg::with_name("neovim_args")
.multiple(true) .multiple(true)
@ -66,7 +74,12 @@ pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
.help("Specify Arguments to pass down to neovim"), .help("Specify Arguments to pass down to neovim"),
) )
// Command-line arguments only // 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(
Arg::with_name("geometry") Arg::with_name("geometry")
.long("geometry") .long("geometry")
@ -151,6 +164,10 @@ pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
.values_of("neovim_args") .values_of("neovim_args")
.map(|opt| opt.map(|v| v.to_owned()).collect()) .map(|opt| opt.map(|v| v.to_owned()).collect())
.unwrap_or_default(), .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 // Command-line arguments only
verbosity: matches.occurrences_of("verbosity"), verbosity: matches.occurrences_of("verbosity"),
geometry: parse_window_geometry(matches.value_of("geometry").map(|i| i.to_owned()))?, geometry: parse_window_geometry(matches.value_of("geometry").map(|i| i.to_owned()))?,

Loading…
Cancel
Save