diff options
author | Adam Hovorka <[email protected]> | 2020-06-05 17:12:07 -0600 |
---|---|---|
committer | Adam Hovorka <[email protected]> | 2020-06-05 17:12:07 -0600 |
commit | 7dc51d83483f5e5c8594a282c19c7ac5a34669d5 (patch) | |
tree | f8f5721965dc1dbaba2f43016c010e5c643736de /base/zsh/completion.zsh | |
parent | 424a5386b0392ffe4377f4009f01ddf520a7bc64 (diff) |
Add clipboard and completion to otp
Diffstat (limited to 'base/zsh/completion.zsh')
-rw-r--r-- | base/zsh/completion.zsh | 11 |
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 |