From d0fe3fcb5ae3feca5827da7e4ee8f27a3749d3e5 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Fri, 2 Sep 2022 12:59:30 +0200 Subject: [PATCH] Add missing "--" The current token is often an option, and it shouldn't spew. Also silence stderr for `cargo search` in case lookup fails. --- share/completions/cargo.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/completions/cargo.fish b/share/completions/cargo.fish index a05d9f779..b444ff713 100644 --- a/share/completions/cargo.fish +++ b/share/completions/cargo.fish @@ -28,7 +28,7 @@ complete -c cargo -n '__fish_seen_subcommand_from run test build debug check' -l # Look up crates.io crates matching the the single argument provided to this function function __fish_cargo_search - if test (string length "$argv[1]") -le 2 + if test (string length -- "$argv[1]") -le 2 # Don't waste time searching for strings with too many results to realistically # provide a meaningful completion within our results limit. return @@ -36,7 +36,7 @@ function __fish_cargo_search # This doesn't do a prefix search, so bump up the limit a tiny bit to try and # get enough results to show something. - cargo search --color never --quiet --limit 20 $argv[1] | + cargo search --color never --quiet --limit 20 -- $argv[1] 2>/dev/null | # Filter out placeholders and "... and xxx more crates" string match -rvi '^\.\.\.|= "0.0.0"|# .*(reserved|yanked)' | # Remove the version number and map the description