commit 4e73cdc4c376ad61d2e4858bc87cf01eab0dd403
parent 918992c19231b33b3d4a3288a7288a620e608cb4
Author: Johannes Altmanninger <aclopte@gmail.com>
Date: Tue, 18 May 2021 22:59:25 +0200
fish-completion: don't print full path when PASSWORD_STORE_DIR is set
"__fish_pass_print" enumerates all files in the password store and
uses sed to strip their common prefix - the password store directory.
If $PASSWORD_STORE_DIR had a trailing slash, sed would fail to remove
the prefix. Fix this by canonicalizing $PASSWORD_STORE_DIR.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/completion/pass.fish-completion b/src/completion/pass.fish-completion
@@ -6,11 +6,11 @@
set -l PROG 'pass'
function __fish_pass_get_prefix
- set -l prefix "$PASSWORD_STORE_DIR"
- if [ -z "$prefix" ]
- set prefix "$HOME/.password-store"
+ if set -q PASSWORD_STORE_DIR
+ realpath -- "$PASSWORD_STORE_DIR"
+ else
+ echo "$HOME/.password-store"
end
- echo "$prefix"
end
function __fish_pass_needs_command