Syntax completion in fish shell fails[0] for pass v1.7.3 when the store is empty. I have isolated the issue to fab65bda88ea979dbbc49f3d856a1d14ee4f1296[1] and verified the completion file from previous commit works.

It is the fish's strict glob handling getting in the way. Attempted patch attached. I am leaving an explanation comment in there so this does not get reverted again accidentally.

[0]
```
$ pass in<TAB>/usr/share/fish/vendor_ completions.d/pass.fish (line 42): No matches for wildcard “"$prefix"/**"$ext"”. See `help expand`.
     printf '%s\n' "$prefix"/**"$ext" | sed "s#$prefix/\(.*\)$strip#\1#"
                   ^
in function “__fish_pass_print”
        called on line 99 of file /usr/share/fish/vendor_completions.d/pass.fish
        with parameter list “.gpg .gpg”

in function “__fish_pass_print_entries”
        called on standard input

in command substitution
        called on standard input
```

[1] https://git.zx2c4.com/password-store/commit/src/completion/pass.fish-completion?id=fab65bda88ea979dbbc49f3d856a1d14ee4f1296

Cheers!
--
oliver

>From 090194d5514d14692b93a4bab4e491ddb8975f06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oliver=20Gond=C5=BEa?= <[email protected]>
Date: Wed, 20 Mar 2019 12:45:49 +0100
Subject: [PATCH] Fish completion: Handle empty directory gracefully

---
 src/completion/pass.fish-completion | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git src/completion/pass.fish-completion src/completion/pass.fish-completion
index 8637874..e29e991 100644
--- src/completion/pass.fish-completion
+++ 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 files "$prefix"/**"$ext" # Evaluate the glob in `set` to handle empty directory gracefully
+    printf '%s\n' $files | sed "s#$prefix/\(.*\)$strip#\1#"
 end
 
 function __fish_pass_print_entry_dirs
-- 
2.21.0


_______________________________________________
Password-Store mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to