diff --git a/src/complete.rs b/src/complete.rs index 2ffa8c461..d8f67867c 100644 --- a/src/complete.rs +++ b/src/complete.rs @@ -999,11 +999,14 @@ fn complete_cmd_desc(&mut self, s: &wstr) { // systems with a large set of manuals, but it should be ok since apropos is only called once. // For Cygwin, also try to find the exact match for the non-exe name let lookup_cmd = sprintf!( - "functions -q __fish_describe_command &&{ __fish_describe_command %s %s}", + "functions -q __fish_describe_command &&{ __fish_describe_command -- %s %s}", &escape(cmd), &no_exe .map(|(cmd_sans_exe, _)| { - sprintf!("; __fish_describe_command --exact %s", escape(cmd_sans_exe)) + sprintf!( + "; __fish_describe_command --exact -- %s", + escape(cmd_sans_exe) + ) }) .unwrap_or_default()[..] ); diff --git a/tests/checks/complete.fish b/tests/checks/complete.fish index 61b4cddeb..b88c0bccd 100644 --- a/tests/checks/complete.fish +++ b/tests/checks/complete.fish @@ -691,3 +691,12 @@ complete command-line-aware-completions -xa "(commandline --cursor; commandline complete -C"command-line-aware-completions " # CHECK: 31 # CHECK: command-line-aware-completions + +begin + : >"$TMPDIR/-command-starting-with-dash" + chmod +x "$TMPDIR/-command-starting-with-dash" + + set -l PATH "$TMPDIR" $PATH + complete -C"-command-starting-with" + # CHECK: -command-starting-with-dash{{\t}}command +end