aboutsummaryrefslogtreecommitdiff
path: root/compl/crypt.zsh
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2023-11-12 17:38:35 +0100
committerFederico Angelilli <code@fedang.net>2023-11-12 17:38:35 +0100
commit4647620d0bd5896a8d7f3302ac353842645d02b8 (patch)
treef497c4643c1f0b4c3238ced02898758199fb6ac6 /compl/crypt.zsh
parent740d53bc517f7718a4373c9d16b66a8f204039f0 (diff)
Add (very basic) zsh completion
Diffstat (limited to 'compl/crypt.zsh')
-rwxr-xr-xcompl/crypt.zsh11
1 files changed, 11 insertions, 0 deletions
diff --git a/compl/crypt.zsh b/compl/crypt.zsh
new file mode 100755
index 0000000..725c328
--- /dev/null
+++ b/compl/crypt.zsh
@@ -0,0 +1,11 @@
+#compdef crypt
+#autoload
+
+_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):-""}
+}
+
+_crypt