Updated to support single letter stacking.
Please see new files listed below:
-- /usr/share/zsh/vendor-completions/_keepassxc
#compdef keepassxc
_arguments -C -S -s \
    '(- 1 *)'{-h,--help}'[Displays help on commandline options.]' \
    '(- 1 *)'--help-all'[Displays help including Qt specific options.]' \
    '(- 1 *)'{-v,--version}'[Displays version information.]' \
    --config='[path to a custom config file]':'<config>':_files \
    --localconfig='[path to a custom local config file]':'<localconfig>':_files 
\
    --lock'[lock all open databases]' \
    --keyfile='[key file of the database]':'<keyfile>':_files \
    --pw-stdin'[read password of the database from stdin]' \
    '(- 1 *)'--debug-info'[Displays debugging information.]' \
    --allow-screencapture'[allows screenshots and app recording 
(Windows/macOS)]' \
    --minimized'[start minimized to the system tray]' \
    '*:filename(s):_files'
-- end /usr/share/zsh/vendor-completions/_keepassxc

-- /usr/share/zsh/vendor-completions/_keepassxc-cli
#compdef keepassxc-cli
# Greatest reference ever: 
https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Completion-System
# This is wizardry
# Credits to _aptitude for showing usage of _describe
# Credits to /usr/share/zsh/functions/Completions/Linux/_ss for showing 
_arguments -s proper usage

local curcontext="$curcontext" state lstate line
typeset -A opt_args

local -a subcmds

subcmds=(add':Add a new entry to a database.'
    analyze':Analyze passwords for weaknesses and problems.'
    'attachment-export:Export an attachment of an entry.'
    'attachment-import:Imports an attachment to an entry.'
    'attachment-rm:Remove an attachment of an entry.'
    "clip:Copy an entry's attribute to the clipboard."
    close':Close the currently opened database.'
    'db-create:Create a new database.'
    'db-edit:Edit a database.'
    "db-info:Show a database's information."
    diceware':Generate a new random diceware passphrase.'
    edit':Edit an entry.'
    estimate':Estimate the entropy of a password.'
    exit:'Exits interactive mode. Synonymous with quit. (Invalid subcommand)'
    export':Exports the content of a database to standard output in the 
specified format.'
    generate':Generate a new random password.'
    help':Display command help.'
    import':Import the contents of an XML database.'
    ls':List database entries.'
    merge':Merge two databases.'
    mkdir':Adds a new group to a database.'
    mv':Moves an entry to a new group.'
    open':Open a database.'
    quit':Exits interactive mode. Synonymous with exit. (Invalid subcommand)'
    rm':Remove an entry from the database.'
    rmdir':Removes a group from a database.'
    search':Find entries quickly.'
    show":Show an entry's information.")

_arguments -C -S -s \
    '(- 1 *)'--debug-info'[Displays debugging information.]' \
    '(- 1 *)'{-h,--help}'[Displays help on commandline options.]' \
    '(- 1 *)'--help-all'[Displays help including Qt specific options.]' \
    '(- 1 *)'{-v,--version}'[Displays version information.]' \
    ': :->cmds' \
    '*:: :->args'
case "$state" in
cmds)
    _describe -t commands 'keepassxc-cli [options] command' subcmds
    ;;
args)
    case $line[1] in
    add)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-u --username)'{-u+,--username=}'[Username for the 
entry.]:<username>' \
            --url='[URL for the entry.]:<URL>:_urls' \
            --notes='[Notes for the entry.]:<Notes>' \
            '(-p --password-prompt)'{-p,--password-prompt}"[Prompt for the 
entry's password.]" \
            '(-g --generate)'{-g,--generate}"[Generate a password the entry.]" \
            '(-L --length)'{-L+,--length=}"[Length of the generated 
password]:<length>:_numbers" \
            '(-l --lower)'{-l,--lower}"[Use lowercase characters]" \
            '(-U --upper)'{-U,--upper}"[Use uppercase characters]" \
            '(-n --numeric)'{-n,--numeric}"[Use numbers]" \
            '(-s --special)'{-s,--special}"[Use special characters]" \
            '(-e --extended)'{-e,--extended}"[Use extended ASCII]" \
            '(-x --exclude)'{-x+,--exclude=}"[Exclude character set]:<chars>" \
            --exclude-similar"[Exclude similar looking characters]" \
            --every-group"[Include characters from every selected group]" \
            '(-c --custom)'{-c+,--custom=}"[Use custom character set]:<chars>" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>'
        ;;
    analyze)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-H --hibp)'{-H+,--hibp=}'[Check if any passwords have been 
publicly leaked. FILENAME must be the path of a file listing SHA-1 hashes of 
leaked passwords in HIBP format, as available from 
https://haveibeenpwned.com/Passwords.]:<FILENAME>:_files' \
            --okon='[Path to okon-cli to search a formatted HIBP 
file.]:<okon-cli>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files'
        ;;
    attachment-export)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            --stdout"[Output attachment's content to the standard output 
instead of <export_file>.]" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>' \
            ':<attachment_name>' \
            ':<export_file>:_files'
        ;;
    attachment-import)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            "(-f --force){-f,--force}[Overwrite existing attachments.]" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>:_files' \
            ':<attachment_name>' \
            ':<import_file>:_files'
        ;;
    attachment-rm)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            "(-f --force)"{-f,--force}"[Overwrite existing attachments.]" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>' \
            ':<name>'
        ;;
    clip)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-a --attribute)'{-a+,--attribute=}'[Copy the given attribute to 
the clipboard. Defaults to "password" if not specified.]:<attr>' \
            '(-t --totp)'{-t,--totp}'[Copy the current TOTP to the clipboard 
(equivalent to "-a totp").]' \
            '(-b --best-match)'{-b,--best-match}"[Must match only one entry, 
otherwise a list of possible matches is shown.]" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>:_files' \
            '::<timeout>:_numbers'
        ;;
    # close command in keepassxc-cli takes no arguments, not even --help
    close)
        _message "no arguments"
        ;;
    db-create)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            --set-key-file='[Set the key file for the database.]:<path>:_files' 
\
            -k+'[Set the key file for the database. This option is deprecated, 
use --set-key-file instead.]:<path>:_files' \
            '(-p --set-password)'{-p,--set-password}'[Copy the current TOTP to 
the clipboard (equivalent to "-a totp").]' \
            '(-t --decryption-time)'{-t+,--decryption-time=}"[Must match only 
one entry, otherwise a list of possible matches is shown.]:<time>:_numbers" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files'
        ;;
    db-edit)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            --set-key-file='[Set the key file for the database.]:<path>:_files' 
\
            '(-p --set-password)'{-p,--set-password}'[Set a password for the 
database.]' \
            --unset-key-file'[Unset the key file for the database.]' \
            --unset-password'[Unset the password for the database.]' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files'
        ;;
    db-info)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y,--yubikey}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files'
        ;;
    diceware)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-W --words)'{-W+,--words=}'[Word count for the diceware 
passphrase.]:<count>:_numbers' \
            '(-w --word-list)'{-w+,--word-list=}'[Wordlist for the diceware 
generator. [Default: EFF English\]]:<path>:_files' \
            '(-h --help)'{-h,--help}"[Display this help.]"
        ;;
    edit)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-u --username)'{-u+,--username=}'[Username for the 
entry.]:<username>' \
            --url='[URL for the entry.]:<URL>:_urls' \
            --notes='[Notes for the entry.]:<Notes>' \
            '(-p --password-prompt)'{-p,--password-prompt}"[Prompt for the 
entry's password.]" \
            '(-t --title)'{-t+,--title=}'[Title for the entry.]:<title>' \
            '(-g --generate)'{-g,--generate}"[Generate a password the entry.]" \
            '(-L --length)'{-L+,--length=}"[Length of the generated 
password]:<length>:_numbers" \
            '(-l --lower)'{-l,--lower}"[Use lowercase characters]" \
            '(-U --upper)'{-U,--upper}"[Use uppercase characters]" \
            '(-n --numeric)'{-n,--numeric}"[Use numbers]" \
            '(-s --special)'{-s,--special}"[Use special characters]" \
            '(-e --extended)'{-e,--extended}"[Use extended ASCII]" \
            '(-x --exclude)'{-x+,--exclude=}"[Exclude character set]:<chars>" \
            --exclude-similar"[Exclude similar looking characters]" \
            --every-group"[Include characters from every selected group]" \
            '(-c --custom)'{-c+,--custom=}"[Use custom character set]:<chars>" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>'
        ;;
    estimate)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-a --advanced)'{-a,--advanced}'[Perform advanced analysis on the 
password.]' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            '::<password>'
        ;;
    exit)
        _message "invalid subcommand"
        ;;
    export)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-f --format)'{-f+,--format=}"[Format to use when exporting. 
Available choices are 'xml', 'csv' or 'html'. Defaults to 
'xml'.]:<xml|csv|html>:(xml csv html)" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files'
        ;;
    generate)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-L --length)'{-L+,--length=}"[Length of the generated 
password]:<length>:_numbers" \
            '(-l --lower)'{-l,--lower}"[Use lowercase characters]" \
            '(-U --upper)'{-U,--upper}"[Use uppercase characters]" \
            '(-n --numeric)'{-n,--numeric}"[Use numbers]" \
            '(-s --special)'{-s,--special}"[Use special characters]" \
            '(-e --extended)'{-e,--extended}"[Use extended ASCII]" \
            '(-x --exclude)'{-x+,--exclude=}"[Exclude character set]:<chars>" \
            --exclude-similar"[Exclude similar looking characters]" \
            --every-group"[Include characters from every selected group]" \
            '(-c --custom)'{-c+,--custom=}"[Use custom character set]:<chars>" \
            '(-h --help)'{-h,--help}"[Display this help.]"
        ;;
    help)
        _arguments -C -S -s "1:: :->cmds"
        case $state in
        cmds)
            _describe -t commands 'keepassxc-cli help [command]' subcmds
            ;;
        esac
        ;;
    import)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            --set-key-file='[Set the key file for the database.]:<path>:_files' 
\
            -k+'[Set the key file for the database. This option is deprecated, 
use --set-key-file instead.]:<path>:_files' \
            '(-p --set-password)'{-p,--set-password}'[Copy the current TOTP to 
the clipboard (equivalent to "-a totp").]' \
            '(-t --decryption-time)'{-t+,--decryption-time=}"[Must match only 
one entry, otherwise a list of possible matches is shown.]:<time>:_numbers" \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<xml>:_files' \
            ':<database>:_files'
        ;;
    ls)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-R --recursive)'{-R,--recursive}'[Recursively list the elements 
of the group.]' \
            '(-f --flatten)'{-f,--flatten}'[Flattens the output to single 
lines.]' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            '::<group>'
        ;;
    merge)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-s --same-credentials)'{-s,--same-credentials}'[Use the same 
credentials for both database files.]' \
            --key-file-from='[Key file of the database to merge 
from.]:<path>:_files' \
            --no-password-from'[Deactivate password key for the database to 
merge from.]' \
            '(-d --dry-run)'{-d,--dry-run}'[Only print the changes detected by 
the merge operation.]' \
            --yubikey-from='[Yubikey slot for the second database.]:<slot>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<database2>:_files'
        ;;
    mkdir)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<group>'
        ;;
    mv)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>' \
            ':<group>'
        ;;
    open)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files'
        ;;
    quit)
        _message "invalid subcommand"
        ;;
    rmdir)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<group>'
        ;;
    rm)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>'
        ;;
    search)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<term>'
        ;;
    show)
        _arguments -C -S -s \
            '(-q --quiet)'{-q,--quiet}'[Silence password prompt and other 
secondary outputs.]' \
            '(-k --key-file)'{-k+,--key-file=}'[Key file of the 
database.]:<path>:_files' \
            --no-password'[Deactivate password key for the database.]' \
            '(-y --yubikey)'{-y+,--yubikey=}'[Yubikey slot and optional serial 
used to access the database (e.g., 1:7370001).]:<slot[\:serial]>' \
            '(-t --totp)'{-t,--totp}"[Show the entry's current TOTP.]" \
            '*'{-a+,--attributes=}'[Names of the attributes to show. This 
option can be specified more than once, with each attribute shown one-per-line 
in the given order. If no attributes are specified, a summary of the default 
attributes is given.]:<attribute>' \
            '(-s --show-protected)'{-s,--show-protected}'[Show the protected 
attributes in clear text.]' \
            --all'[Show all the attributes of the entry.]' \
            --show-attachments'[Show the attachments of the entry.]' \
            '(-h --help)'{-h,--help}"[Display this help.]" \
            ':<database>:_files' \
            ':<entry>'
        ;;
    *)
        _message "???"
        ;;
    esac
    ;;
esac
-- end /usr/share/zsh/vendor-completions/_keepassxc-cli

Attachment: publickey - [email protected] - 0xEC8A06ED.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to