mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-23 21:54:45 +02:00
complete/fish: Fix syntax for negated options
And also, negated options don't take arguments.
Specifically, the fish completion generator currently forgets to add
`-l` to negation options, leading to a list of these errors:
complete: too many arguments
~/.config/fish/completions/rg.fish (line 146):
complete -c rg -n '__fish_use_subcommand' no-sort-files -d '(DEPRECATED) Sort results by file path.'
^
from sourcing file ~/.config/fish/completions/rg.fish
(Type 'help complete' for related documentation)
To reproduce, run `fish -c 'rg --generate=complete-fish | source'`.
It also potentially suggests a list of choices for negation options,
even though those never take arguments. That case doesn't occur with
any of the current options but it's an easy fix.
Fixes #2659, Closes #2655
This commit is contained in:
committed by
Andrew Gallant
parent
2e81a7adfe
commit
8575d26179
@@ -35,10 +35,11 @@ pub(crate) fn generate() -> String {
|
||||
.replace("!DOC!", &doc),
|
||||
);
|
||||
if let Some(negated) = flag.name_negated() {
|
||||
let long = format!("-l '{}'", negated.replace("'", "\\'"));
|
||||
out.push_str(
|
||||
&template
|
||||
&TEMPLATE
|
||||
.replace("!SHORT!", "")
|
||||
.replace("!LONG!", &negated)
|
||||
.replace("!LONG!", &long)
|
||||
.replace("!DOC!", &doc),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user