dotfiles/zsh/zsh-completions/_bw
2023-07-14 22:39:37 +02:00

429 lines
No EOL
12 KiB
Text

#compdef _bw bw
function _bw {
local -a commands
_arguments -C \
'--pretty[Format output. JSON is tabbed with two spaces.]' \
'--raw[Return raw output instead of a descriptive message.]' \
'--response[Return a JSON formatted version of response output.]' \
'--cleanexit[Exit with a success exit code (0) unless an error is thrown.]' \
'--quiet[Don'"'"'t return anything to stdout.]' \
'--nointeraction[Do not prompt for interactive user input.]' \
'--session[Pass session key instead of reading from env.]' \
'(-v --version)'{-v,--version}'[output the version number]' \
'(-h --help)'{-h,--help}'[output usage information]' \
"1: :->cmnds" \
"*::arg:->args"
case $state in
cmnds)
commands=(
"login:Log into a user account."
"logout:Log out of the current user account."
"lock:Lock the vault and destroy active session keys."
"unlock:Unlock the vault and return a new session key."
"sync:Pull the latest vault data from server."
"generate:Generate a password/passphrase."
"encode:Base 64 encode stdin."
"config:Configure CLI settings."
"update:Check for updates."
"completion:Generate shell completions."
"status:Show server, last sync, user information, and vault status."
"serve:Start a RESTful API webserver."
"list:List an array of objects from the vault."
"get:Get an object from the vault."
"create:Create an object in the vault."
"edit:Edit an object from the vault."
"delete:Delete an object from the vault."
"restore:Restores an object from the trash."
"move:Move an item to an organization."
"confirm:Confirm an object to the organization."
"import:Import vault data from a file."
"export:Export vault data to a CSV or JSON file."
"share:--DEPRECATED-- Move an item to an organization."
"send:Work with Bitwarden sends. A Send can be quickly created using this command or subcommands can be used to fine-tune the Send"
"receive:Access a Bitwarden Send from a url"
)
_describe "command" commands
;;
esac
case "$words[1]" in
login)
_bw_login
;;
logout)
_bw_logout
;;
lock)
_bw_lock
;;
unlock)
_bw_unlock
;;
sync)
_bw_sync
;;
generate)
_bw_generate
;;
encode)
_bw_encode
;;
config)
_bw_config
;;
update)
_bw_update
;;
completion)
_bw_completion
;;
status)
_bw_status
;;
serve)
_bw_serve
;;
list)
_bw_list
;;
get)
_bw_get
;;
create)
_bw_create
;;
edit)
_bw_edit
;;
delete)
_bw_delete
;;
restore)
_bw_restore
;;
move)
_bw_move
;;
confirm)
_bw_confirm
;;
import)
_bw_import
;;
export)
_bw_export
;;
share)
_bw_share
;;
send)
_bw_send
;;
receive)
_bw_receive
;;
esac
}
function _bw_login {
_arguments -C \
'--method[Two-step login method.]' \
'--code[Two-step login code.]' \
'--sso[Log in with Single-Sign On.]' \
'--apikey[Log in with an Api Key.]' \
'--passwordenv[Environment variable storing your password]' \
'--passwordfile[Path to a file containing your password as its first line]' \
'--check[Check login status.]' \
'(-h --help)'{-h,--help}'[output usage information]' \
"*::arg:->args"
}
function _bw_logout {
}
function _bw_lock {
}
function _bw_unlock {
_arguments -C \
'--check[Check lock status.]' \
'--passwordenv[Environment variable storing your password]' \
'--passwordfile[Path to a file containing your password as its first line]' \
'(-h --help)'{-h,--help}'[output usage information]' \
"*::arg:->args"
}
function _bw_sync {