From af120ab348f2e1a5a39dec035ed9dcf84189a64e Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Mon, 3 Oct 2022 21:42:20 +0530 Subject: dotfiles --- zsh/oh-my-zsh/plugins/1password/_opswd | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 zsh/oh-my-zsh/plugins/1password/_opswd (limited to 'zsh/oh-my-zsh/plugins/1password/_opswd') diff --git a/zsh/oh-my-zsh/plugins/1password/_opswd b/zsh/oh-my-zsh/plugins/1password/_opswd new file mode 100644 index 0000000..dbc094f --- /dev/null +++ b/zsh/oh-my-zsh/plugins/1password/_opswd @@ -0,0 +1,19 @@ +#compdef opswd + +function _opswd() { + local -a services + services=("${(@f)$(op item list --categories Login --cache 2>/dev/null | awk 'NR != 1 { print $2 }')}") + [[ -z "$services" ]] || compadd -a -- services +} + +# TODO: 2022-03-26: Remove support for op CLI 1 +autoload -Uz is-at-least +is-at-least 2.0.0 $(op --version) || { + function _opswd() { + local -a services + services=("${(@f)$(op list items --categories Login 2>/dev/null | op get item - --fields title 2>/dev/null)}") + [[ -z "$services" ]] || compadd -a -- services + } +} + +_opswd "$@" -- cgit v1.2.3-59-g8ed1b