aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2023-12-22 16:21:39 +0100
committerFederico Angelilli <code@fedang.net>2023-12-22 16:21:39 +0100
commit227214b80f06a438710f2ce29efb3c9e0c24e410 (patch)
treea46071a3fe32d230d335b1b62065d670325f1fb7
parent8f8367d5a52948a8032f72fef85358beff18bef7 (diff)
Update autocompletion scripts
-rwxr-xr-xcompl/crypt.bash2
-rwxr-xr-xcompl/crypt.zsh6
2 files changed, 5 insertions, 3 deletions
diff --git a/compl/crypt.bash b/compl/crypt.bash
index 8631050..3074ff5 100755
--- a/compl/crypt.bash
+++ b/compl/crypt.bash
@@ -5,7 +5,7 @@
_crypt() {
COMPREPLY=()
- local location="${CRYPT_LOCATION:-$HOME/.crypt}"
+ local location="${CRYPT_PATH:-$HOME/.crypt}"
location="${location%/}/"
local cur="${COMP_WORDS[COMP_CWORD]}"
diff --git a/compl/crypt.zsh b/compl/crypt.zsh
index 725c328..2e1e57a 100755
--- a/compl/crypt.zsh
+++ b/compl/crypt.zsh
@@ -1,11 +1,13 @@
#compdef crypt
#autoload
+# copy to /usr/share/zsh/site-functions/_crypt
+
_crypt() {
local IFS=$'\n'
local location
- zstyle -s ":completion:${curcontext}:" location location || location="${CRYPT_LOCATION:-$HOME/.crypt}"
- _values -C 'entries' ${$(find -L "$location" -name '*.gpg' -type f -print 2>/dev/null | sed -e "s#${location}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#g' -e 's#:#\\:#g' -e 's/\.\(pass\|otp\|txt\)/\[\1\]/' | sort):-""}
+ zstyle -s ":completion:${curcontext}:" location location || location="${CRYPT_PATH:-$HOME/.crypt}"
+ _values -C 'entries' ${$(crypt list --plain | sed -e "s#\([^[:space:]]*\)[[:space:]]*\(.*\)#\1\[\2\]#g" | sort):-""}
}
_crypt