mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-23 00:03:24 +01:00
dbadfa0810
This change still supports CLI 1, but shows a deprecation warning on the first run of `opswd`. Support for CLI 1 shall be removed in the near future. Closes #10787 Co-authored-by: Marc Cornellà <hello@mcornella.com>
20 lines
555 B
Plaintext
20 lines
555 B
Plaintext
#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 "$@"
|