[PATCH] Fix wildcard match in Fish shell completion script

Gianluca Recchia gianluca.recchia97 at libero.it
Tue Feb 25 10:03:41 CET 2020


Trying to tab-complete the pass command in the Fish shell, when there
are no passwords stored, will result in a big error message being
printed on the console which reports the fact that nothing matches the
wildcard expansion.

Setting the result of the wildcard expansion to a variable first and
then trying to use the variable suppresses the error.
---
 src/completion/pass.fish-completion | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/completion/pass.fish-completion b/src/completion/pass.fish-completion
index 8637874..a974d7e 100644
--- a/src/completion/pass.fish-completion
+++ b/src/completion/pass.fish-completion
@@ -39,7 +39,8 @@ function __fish_pass_print
     set -l ext $argv[1]
     set -l strip $argv[2]
     set -l prefix (__fish_pass_get_prefix)
-    printf '%s\n' "$prefix"/**"$ext" | sed "s#$prefix/\(.*\)$strip#\1#"
+    set -l matches "$prefix"/**"$ext"
+    printf '%s\n' $matches | sed "s#$prefix/\(.*\)$strip#\1#"
 end
 
 function __fish_pass_print_entry_dirs
-- 
2.25.1



More information about the Password-Store mailing list