diff --git a/src/main.rs b/src/main.rs index c723046..e54ed28 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,7 +62,7 @@ fn maybe_process_path(arg: &str) -> String { return format!("'{replaced_single_quotes}'",); } - arg.to_string() + arg.split(' ').last().unwrap().to_string() } fn get_string_from_files(root_args: &RootArgs) -> String { diff --git a/tests/test_complete_git.rs b/tests/test_complete_git.rs index 7256c24..c5dbe23 100644 --- a/tests/test_complete_git.rs +++ b/tests/test_complete_git.rs @@ -11,6 +11,13 @@ use crate::speculoos::prelude::ContainingIntoIterAssertions; mod testenv; pub use testenv::*; +#[apply(shell_to_use)] +fn test_primary_command_is_not_included(shell: &str) { + let lines = util::run_command(shell, "Invoke-TabComplete 'git check'"); + assert_that!(lines).does_not_contain("git checkout".to_string()); + assert_that!(lines).contains("checkout".to_string()); +} + #[apply(shell_to_use)] fn test_checkout_branches(shell: &str) { let lines = util::run_command(shell, "Invoke-TabComplete 'git checkout '");