aboutsummaryrefslogtreecommitdiff
path: root/base/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'base/zsh')
-rw-r--r--base/zsh/completion.zsh11
1 files changed, 11 insertions, 0 deletions
diff --git a/base/zsh/completion.zsh b/base/zsh/completion.zsh
index f9e452d..ae4d7c3 100644
--- a/base/zsh/completion.zsh
+++ b/base/zsh/completion.zsh
@@ -79,3 +79,14 @@ fi
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
+_otp() {
+ local IFS=$'\n'
+ local prefix
+ _arguments : \
+ "-c[put it on the clipboard]" \
+ "--clip[put it on the clipboard]"
+ zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
+ _values -C 'passwords' ${$(find -L "$prefix/otp" \( -name .git -o -name .gpg-id \) -prune -o -type f -print 2>/dev/null | sed -e "s#${prefix}/otp/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#' | sort):-""}
+}
+
+compdef _otp otp