diff --git a/src/main.rs b/src/main.rs index 87ab48f..5f0273f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,7 +64,7 @@ fn open_arg() -> Option { fn open_arg_impl(args: I) -> Option where I: Iterator { - args.last().map(|a| { + args.skip(1).last().map(|a| { if !a.starts_with("-") { Some(a.to_owned()) } else { @@ -101,4 +101,10 @@ mod tests { assert_eq!(Some("some_file.txt".to_string()), open_arg_impl(vec!["neovim-gtk", "--nvim-bin-path=/test_path", "some_file.txt"].iter().map(|s| s.to_string()))); } + + #[test] + fn test_empty_open_arg() { + assert_eq!(None, + open_arg_impl(vec!["neovim-gtk"].iter().map(|s| s.to_string()))); + } }