Files
2026-10-10 10:53:44 +02:00

596 lines
26 KiB
Plaintext

#compdef gopass
_gopass () {
local cmd
if (( CURRENT > 2)); then
cmd=${words[2]}
curcontext="${curcontext%:*:*}:gopass-$cmd"
(( CURRENT-- ))
shift words
case "${cmd}" in
age)
local -a subcommands
subcommands=(
"agent:Manage the age agent"
"identities:List age identities used for decryption and encryption"
"lock:Lock the age agent"
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass age" subcommands
_arguments : "--age-sshkeys[Load SSH keys from default SSH directory]" "--age-ssh-key-path[Custom path to additional SSH key or directory of keys for age backend]" "--help[show help]"
;;
alias)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass alias" subcommands
_arguments : "--help[show help]"
;;
audit)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass audit" subcommands
_arguments : "--format[Output format. text, csv, html or json. Default: text]" "--output-file[Output filename. Used for csv and html]" "--template[HTML template. If not set use the built-in default.]" "--full[Print full details of all findings. Default: false]" "--summary[Print a summary of the audit results. Default: true (print summary)]" "--help[show help]"
;;
cat)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass cat" subcommands
_arguments : "--help[show help]"
;;
clone)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass clone" subcommands
_arguments : "--path[Path to clone the repo to]" "--crypto[Select crypto backend \[age gpgcli plain\]]" "--storage[Select storage backend \[cryptfs fossilfs gitfs jjfs\]]" "--check-keys[Check for valid decryption keys. Generate new keys if none are found.]" "--help[show help]"
;;
completion)
local -a subcommands
subcommands=(
"bash:Source for auto completion in bash"
"zsh:Source for auto completion in zsh"
"fish:Source for auto completion in fish"
"openbsdksh:Source for auto completion in OpenBSD's ksh"
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass completion" subcommands
_arguments : "--help[show help]"
;;
config)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass config" subcommands
_arguments : "--store[Set options to a specific store]" "--help[show help]"
;;
convert)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass convert" subcommands
_arguments : "--store[Specify which store to convert]" "--move[Replace store?]" "--crypto[Which crypto backend? \[age gpgcli plain\]]" "--storage[Which storage backend? \[cryptfs fossilfs fs gitfs jjfs\]]" "--help[show help]"
;;
copy|cp)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass copy" subcommands
_arguments : "--force[Force to copy the secret and overwrite existing one]" "--commit-message[Set the commit message]" "--interactive-commit[Open an editor for the commit message]" "--help[show help]"
_gopass_complete_passwords
;;
create|new)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass create" subcommands
_arguments : "--store[Which store to use]" "--force[Force path selection]" "--help[show help]"
;;
delete|remove|rm)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass delete" subcommands
_arguments : "--recursive[Recursive delete files and folders]" "--force[Force to delete the secret]" "--commit-message[Set the commit message]" "--interactive-commit[Open an editor for the commit message]" "--help[show help]"
_gopass_complete_passwords
;;
doctor)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass doctor" subcommands
_arguments : "--verbose[Show passing checks in addition to warnings and errors]" "--recipients[Run a detailed recipient consistency diagnostic (canonical IDs, missing keys, .public-keys/ status)]" "--help[show help]"
;;
edit|set)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass edit" subcommands
_arguments : "--editor[Use this editor binary]" "--force[Force overwriting and encrypting even if none of your local keys is among the recipients]" "--create[Create a new secret if none found]" "--commit-message[Set the commit message]" "--interactive-commit[Open an editor for the commit message]" "--help[show help]"
_gopass_complete_passwords
;;
env)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass env" subcommands
_arguments : "--keep-case[Do not capitalize the environment variable and instead retain the original capitalization]" "--stdin[Pipe the secret's password to the subprocess's stdin instead of setting an environment variable]" "--file[Write each secret to a ramdisk temp file and export KEY_FILE=/path instead of KEY=value]" "--exec[Replace the current process with the subprocess via exec(3) rather than spawning a child process (not supported on Windows)]" "--help[show help]"
;;
find|search)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass find" subcommands
_arguments : "--unsafe[In the case of an exact match, display the password even if safecontent is enabled]" "--regex[Interpret pattern as regular expression]" "--json[Output matches as JSON array]" "--help[show help]"
;;
fsck)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass fsck" subcommands
_arguments : "--decrypt[Decrypt and reencrypt during fsck.]" "--store[Limit fsck to this mount point]" "--help[show help]"
;;
fscopy)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass fscopy" subcommands
_arguments : "--help[show help]"
;;
fsmove)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass fsmove" subcommands
_arguments : "--help[show help]"
;;
generate)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass generate" subcommands
_arguments : "--clip[Copy the generated password to the clipboard]" "--print[Print the generated password to the terminal]" "--force[Force to overwrite existing password]" "--edit[Open secret for editing after generating a password]" "--symbols[Use symbols in the password]" "--generator[Choose a password generator, use one of: cryptic, memorable, xkcd or external. Default: cryptic]" "--strict[Require strict character class rules]" "--force-regen[Force full re-generation, incl. evaluation of templates. Will overwrite the entire secret!]" "--xkcd-sep[Word separator for generated XKCD passwords. If no separator is specified, the words are combined without spaces/separator and the first character of words is capitalised.]" "--xkcd-lang[Language to generate XKCD password from, currently only en (english, default) or de are supported]" "--xkcd-capitalize[Capitalize first letter of each word in the generated XKCD password]" "--xkcd-numbers[Add a random number to the end of the generated XKCD password]" "--commit-message[Set the commit message]" "--interactive-commit[Open an editor for the commit message]" "--help[show help]"
_gopass_complete_folders
_gopass_complete_passwords
;;
git)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass git" subcommands
_arguments : "--store[Store to operate on]" "--help[show help]"
;;
grep)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass grep" subcommands
_arguments : "--regexp[Interpret pattern as RE2 regular expression]" "--help[show help]"
;;
history|hist)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass history" subcommands
_arguments : "--password[Include passwords in output]" "--help[show help]"
;;
init)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass init" subcommands
_arguments : "--path[Set the sub-store path to operate on]" "--store[Set the name of the sub-store]" "--crypto[Select crypto backend \[age gpgcli plain\]]" "--storage[Select storage backend \[cryptfs fossilfs fs gitfs jjfs\]]" "--help[show help]"
;;
insert)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass insert" subcommands
_arguments : "--echo[Display secret while typing]" "--multiline[Insert using $EDITOR]" "--force[Overwrite any existing secret and do not prompt to confirm recipients]" "--append[Append data read from STDIN to existing data]" "--commit-message[Set the commit message]" "--interactive-commit[Open an editor for the commit message]" "--help[show help]"
_gopass_complete_folders
_gopass_complete_passwords
;;
link|ln|symlink)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass link" subcommands
_arguments : "--help[show help]"
;;
list|ls)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass list" subcommands
_arguments : "--limit[Display no more than this many levels of the tree]" "--flat[Print a flat list]" "--folders[Print a flat list of folders]" "--strip-prefix[Strip this prefix from filtered entries]" "--json[Output as JSON array]" "--help[show help]"
_gopass_complete_folders
;;
merge)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass merge" subcommands
_arguments : "--delete[Remove merged entries]" "--force[Skip editor, merge entries unattended]" "--help[show help]"
;;
mounts)
local -a subcommands
subcommands=(
"add:Mount a password store"
"remove:Umount an mounted password store"
"versions:Display mount provider versions"
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass mounts" subcommands
_arguments : "--help[show help]"
;;
move|mv)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass move" subcommands
_arguments : "--force[Force to move the secret and overwrite existing one]" "--commit-message[Set the commit message]" "--interactive-commit[Open an editor for the commit message]" "--help[show help]"
_gopass_complete_passwords
;;
otp|totp|hotp)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass otp" subcommands
_arguments : "--alsoclip[Copy the time-based token and show it]" "--clip[Copy the time-based token into the clipboard]" "--qr[Write QR code to FILE]" "--chained[chain the token to the password]" "--password[Only display the token]" "--snip[Scan screen content to insert a OTP QR code into provided entry]" "--help[show help]"
_gopass_complete_passwords
;;
process)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass process" subcommands
_arguments : "--allow-path[Restrict template secret access to the given path prefix (repeatable). If omitted all secrets in the store are accessible.]" "--help[show help]"
;;
pull)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass pull" subcommands
_arguments : "--store[Select the store to pull]" "--help[show help]"
;;
push)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass push" subcommands
_arguments : "--store[Select the store to push]" "--help[show help]"
;;
pwgen)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass pwgen" subcommands
_arguments : "--no-numerals[Do not include numerals in the generated passwords.]" "--no-capitalize[Do not include capital letter in the generated passwords.]" "--ambiguous[Do not include characters that could be easily confused with each other, like '1' and 'l' or '0' and 'O']" "--symbols[Include at least one symbol in the password.]" "--one-per-line[Print one password per line]" "--xkcd[Use multiple random english words combined to a password. By default, space is used as separator and all words are lowercase]" "--xkcd-sep[Word separator for generated xkcd style password. If no separator is specified, the words are combined without spaces/separator and the first character of words is capitalised. This flag implies -xkcd]" "--xkcd-lang[Language to generate password from, currently only en (english, default) or de are supported]" "--xkcd-capitalize[Capitalize first letter of each word in generated xkcd style password. This flag implies -xkcd]" "--xkcd-numbers[Add a random number to the end of the generated xkcd style password. This flag implies -xkcd]" "--memorable[Use the memorable (word-based) password generator. The requested length is a minimum (output may be longer). Incompatible with --no-numerals (memorable always includes digits).]" "--memorable-capitalize[Capitalize (some) words in the generated memorable password. This flag implies --memorable]" "--help[show help]"
;;
rcs)
local -a subcommands
subcommands=(
"init:Init RCS repo"
"status:RCS status"
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass rcs" subcommands
_arguments : "--help[show help]"
;;
recipients)
local -a subcommands
subcommands=(
"list:List recipients in a subtree"
"ack:Update recipients.hash"
"canonicalize:Canonicalize all recipient IDs in a store"
"add:Add any number of Recipients to any store"
"remove:Remove any number of Recipients from any store"
"update:Update public keys of recipients in the store"
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass recipients" subcommands
_arguments : "--pretty[Pretty print recipients]" "--json[Output recipients as JSON array]" "--help[show help]"
;;
reorg)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass reorg" subcommands
_arguments : "--help[show help]"
;;
secret-service)
local -a subcommands
subcommands=(
"serve:Start the Secret Service daemon (blocks until interrupted)"
"status:Check whether a Secret Service provider is running"
"install:Install the systemd user unit and D-Bus session activation file"
"uninstall:Remove the systemd user unit and D-Bus session activation file"
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass secret-service" subcommands
_arguments : "--help[show help]"
;;
setup)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass setup" subcommands
_arguments : "--remote[URL to a git remote, will attempt to join this team]" "--team[Name of the team to create or join (may contain slashes). Also used as the local mount point.]" "--create-team[Create a new team instead of joining an existing one (default: false, i.e. join an existing team)]" "--name[Firstname and Lastname for unattended GPG key generation]" "--email[EMail for unattended GPG key generation]" "--crypto[Select crypto backend \[age gpgcli plain\]]" "--storage[Select storage backend \[cryptfs fossilfs fs gitfs jjfs\]]" "--help[show help]"
;;
show)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass show" subcommands
_arguments : "--yes[Always answer yes to yes/no questions]" "--clip[Copy the password value into the clipboard. Use -c=N to copy line N (0-indexed)]" "--alsoclip[Copy the password and show everything]" "--qr[Print the password as a QR Code]" "--qrbody[Print the body as a QR Code]" "--unsafe[Display unsafe content (e.g. the password) even if safecontent is enabled]" "--safe[Do not display unsafe content (e.g. the password) even if safecontent is disabled]" "--password[Display only the password. Takes precedence over all other flags.]" "--revision[Show a past revision. Does NOT support RCS specific shortcuts. Use exact revision or -<N> to select the Nth oldest revision of this entry.]" "--noparsing[Do not parse the output.]" "--nofuzzysearch[Do not start fuzzy search when an entry is not found]" "--nosync[Disable auto-sync]" "--chars[Print specific characters from the secret]" "--help[show help]"
_gopass_complete_passwords
;;
sum|sha|sha256)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass sum" subcommands
_arguments : "--help[show help]"
;;
sync)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass sync" subcommands
_arguments : "--store[Select the store to sync]" "--help[show help]"
;;
templates)
local -a subcommands
subcommands=(
"show:Show a secret template."
"edit:Edit secret templates."
"remove:Remove secret templates."
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass templates" subcommands
_arguments : "--help[show help]"
;;
unclip)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass unclip" subcommands
_arguments : "--timeout[Time to wait]" "--force[Clear clipboard even if checksum mismatches]" "--help[show help]"
;;
update)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass update" subcommands
_arguments : "--pre[Include pre-releases (e.g. release candidates)]" "--help[show help]"
;;
version)
local -a subcommands
subcommands=(
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass version" subcommands
_arguments : "--help[show help]"
;;
help|h)
;;
completion)
local -a subcommands
subcommands=(
"bash:Output bash completion script"
"zsh:Output zsh completion script"
"fish:Output fish completion script"
"pwsh:Output pwsh completion script"
"help:Shows a list of commands or help for one command"
)
_describe -t commands "gopass completion" subcommands
_arguments : "--help[show help]"
;;
*)
_gopass_complete_passwords
;;
esac
else
local -a subcommands
subcommands=(
"age:age commands"
"alias:Print domain aliases"
"audit:Decrypt all secrets and scan for weak or leaked passwords"
"cat:Decode and print content of a binary secret to stdout, or encode and insert from stdin"
"clone:Clone a password store from a git repository"
"completion:Bash and ZSH completion"
"config:Display and edit the configuration file"
"convert:Convert a store to different backends"
"copy:Copy secrets from one location to another"
"create:Easy creation of new secrets"
"delete:Remove one or many secrets from the store"
"doctor:Check your gopass installation for common issues"
"edit:Edit new or existing secrets"
"env:Run a subprocess with a pre-populated environment"
"find:Search for secrets"
"fsck:Check store integrity, clean up artifacts and possibly re-write secrets"
"fscopy:Copy files from or to the password store"
"fsmove:Move files from or to the password store"
"generate:Generate a new password"
"git:Run a git command inside a password store: gopass git [--store=<store>] <git-command>"
"grep:Search for secrets files containing search-string when decrypted."
"history:Show password history"
"init:Initialize new password store."
"insert:Insert a new secret"
"link:Create a symlink"
"list:List existing secrets"
"merge:Merge multiple secrets into one"
"mounts:Edit mounted stores"
"move:Move secrets from one location to another"
"otp:Generate time- or hmac-based tokens"
"process:Process a template file"
"pull:Pull a store from its remote"
"push:Push a store to its remote"
"pwgen:Generate passwords"
"rcs:Run a RCS command inside a password store"
"recipients:Edit recipient permissions"
"reorg:Reorganize a password store by editing a text file"
"secret-service:Run a D-Bus Secret Service daemon backed by gopass"
"setup:Initialize a new password store"
"show:Display the content of a secret"
"sum:Compute the SHA256 checksum"
"sync:Sync all local stores with their remotes"
"templates:Edit templates"
"unclip:Internal command to clear clipboard"
"update:Check for updates"
"version:Display version"
"help:Shows a list of commands or help for one command"
"completion:Output shell completion script for bash, zsh, fish, or Powershell"
)
_describe -t command 'gopass' subcommands
_arguments : "--yes[Always answer yes to yes/no questions]" "--clip[Copy the password value into the clipboard. Use -c=N to copy line N (0-indexed)]" "--alsoclip[Copy the password and show everything]" "--qr[Print the password as a QR Code]" "--qrbody[Print the body as a QR Code]" "--unsafe[Display unsafe content (e.g. the password) even if safecontent is enabled]" "--safe[Do not display unsafe content (e.g. the password) even if safecontent is disabled]" "--password[Display only the password. Takes precedence over all other flags.]" "--revision[Show a past revision. Does NOT support RCS specific shortcuts. Use exact revision or -<N> to select the Nth oldest revision of this entry.]" "--noparsing[Do not parse the output.]" "--nofuzzysearch[Do not start fuzzy search when an entry is not found]" "--nosync[Disable auto-sync]" "--chars[Print specific characters from the secret]" "--exit-codes[Print all exit codes and their meanings, then exit]" "--help[show help]" "--version[print the version]"
_gopass_complete_passwords
fi
}
_gopass_complete_keys () {
local IFS=$'\n'
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons 2> /dev/null | cut -d : -f 10 | sort -u | sed '/^$/d')
}
_gopass_complete_passwords () {
local IFS=$'\n'
_arguments : \
"--clip[Copy the first line of the secret into the clipboard]"
_values 'passwords' $(gopass ls --flat | sed 's/\\/\\\\\\\\/g; s/:/\\\\:/g; s/\[/\\\\[/g; s/\]/\\\\]/g')
}
_gopass_complete_folders () {
local -a folders
folders=("${(@f)$(gopass ls --folders --flat)}")
_describe -t folders "folders" folders -qS /
}
compdef _gopass gopass