There is no point to checking the command name, fish already does that.
Additionally fish knows about commands that "wrap" pass; those commands
should inherit pass's completions.

This commit enables fish>=3.1.0 to provide proper completions for this function:

        alias p="PASSWORD_STORE_DIR=$HOME/.my-passwords pass"

or, equivalently,

        function p --wraps "PASSWORD_STORE_DIR=$HOME/.my-passwords pass"
                PASSWORD_STORE_DIR=$HOME/.my-passwords pass $argv
        end
---
 src/completion/pass.fish-completion | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/completion/pass.fish-completion 
b/src/completion/pass.fish-completion
index 1edc3fa..b7c3c8c 100644
--- a/src/completion/pass.fish-completion
+++ b/src/completion/pass.fish-completion
@@ -14,11 +14,7 @@ function __fish_pass_get_prefix
 end
 
 function __fish_pass_needs_command
-    set -l cmd (commandline -opc)
-    if [ (count $cmd) -eq 1 -a $cmd[1] = $PROG ]
-        return 0
-    end
-    return 1
+    [ (count (commandline -opc)) -eq 1 ]
 end
 
 function __fish_pass_uses_command
-- 
2.27.0

Reply via email to