|
|
@ -160,7 +160,7 @@ pub fn handle_command_line_arguments(args: Vec<String>) -> Result<(), String> {
|
|
|
|
|
|
|
|
|
|
|
|
let files_to_open: Vec<String> = matches
|
|
|
|
let files_to_open: Vec<String> = matches
|
|
|
|
.values_of("files_to_open")
|
|
|
|
.values_of("files_to_open")
|
|
|
|
.map(|opt| opt.map(|v| v.to_owned()).collect())
|
|
|
|
.map(|opt| opt.map(String::from).collect())
|
|
|
|
.unwrap_or_default();
|
|
|
|
.unwrap_or_default();
|
|
|
|
|
|
|
|
|
|
|
|
if files_to_open.len() > 1
|
|
|
|
if files_to_open.len() > 1
|
|
|
@ -260,13 +260,20 @@ mod tests {
|
|
|
|
handle_command_line_arguments(args).expect("Could not parse arguments");
|
|
|
|
handle_command_line_arguments(args).expect("Could not parse arguments");
|
|
|
|
assert_eq!(
|
|
|
|
assert_eq!(
|
|
|
|
SETTINGS.get::<CmdLineSettings>().neovim_args,
|
|
|
|
SETTINGS.get::<CmdLineSettings>().neovim_args,
|
|
|
|
vec!["./foo.txt", "./bar.md"]
|
|
|
|
vec!["-p", "./foo.txt", "./bar.md"]
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_files_to_open_with_passthrough() {
|
|
|
|
fn test_files_to_open_with_passthrough() {
|
|
|
|
let args: Vec<String> = vec!["neovide", "./foo.txt", "./bar.md", "--", "--clean"]
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
|
|
|
|
"neovide",
|
|
|
|
|
|
|
|
"--notabs",
|
|
|
|
|
|
|
|
"./foo.txt",
|
|
|
|
|
|
|
|
"./bar.md",
|
|
|
|
|
|
|
|
"--",
|
|
|
|
|
|
|
|
"--clean",
|
|
|
|
|
|
|
|
]
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
.collect();
|
|
|
|
.collect();
|
|
|
@ -281,7 +288,13 @@ mod tests {
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_files_to_open_with_flag() {
|
|
|
|
fn test_files_to_open_with_flag() {
|
|
|
|
let args: Vec<String> = vec!["neovide", "./foo.txt", "./bar.md", "--geometry=42x24"]
|
|
|
|
let args: Vec<String> = vec![
|
|
|
|
|
|
|
|
"neovide",
|
|
|
|
|
|
|
|
"--notabs",
|
|
|
|
|
|
|
|
"./foo.txt",
|
|
|
|
|
|
|
|
"./bar.md",
|
|
|
|
|
|
|
|
"--geometry=42x24",
|
|
|
|
|
|
|
|
]
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
.map(|s| s.to_string())
|
|
|
|
.collect();
|
|
|
|
.collect();
|
|
|
|