diff options
author | Vadim Misbakh-Soloviov <msva@users.noreply.github.com> | 2025-02-19 17:20:14 +0700 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2025-02-27 16:07:36 +0100 |
commit | 1818323f451f426f20ca47c50e8fc63824578479 (patch) | |
tree | cc9742368eb8e3adf8d007daa681509b529804db /Completion | |
parent | e160cf85f05c3106189edf2158146b9f522d1f1c (diff) | |
download | zsh-1818323f451f426f20ca47c50e8fc63824578479.tar.gz zsh-1818323f451f426f20ca47c50e8fc63824578479.zip |
github #129: fix _gpg completion
1) As for now, `--local-user` completion is irrelevant: it completes system users, while gpg expects private keys IDs
2) `secret-keys` completion was also broken and completed nothing.
The reason of that to happen was in that fact that it assumed `uid` token would be next after `fpr` (same as it do in public-keys completion), while in current gnupg versions there is at least `grp` token, and potentially can be others.
So, instead i+=2 I made `until "uid"` loop.
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Unix/Command/_gpg | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg index 2161d2d24..ea0a452f2 100644 --- a/Completion/Unix/Command/_gpg +++ b/Completion/Unix/Command/_gpg @@ -29,7 +29,7 @@ fi '(-c --symmetric)'{-c,--symmetric}'[encrypt with symmetric cipher only]' '(-s --sign)'{-s,--sign}'[make a signature]' '*'{-r+,--recipient}'[specify user to encrypt for]:recipient:->public-keys' - '(-u --local-user)'{-u+,--local-user}'[use name as the user ID to sign]:user attachment:_users' + '(-u --local-user)'{-u+,--local-user}'[use name as the user ID to sign]:key:->secret-keys' '(-o --output)'{-o+,--output}'[write output to file]:output file:_files' '(-h --help)'{-h,--help}'[display usage information]' '--version[print info on program version and supported algorithms]' @@ -238,7 +238,11 @@ case "$state" in parts=("${(@s.:.)secret_keys_lines[$i]}") if [[ ${parts[1]} == "fpr" ]]; then current_uid="${parts[10]}" - i=$((i + 1)) + until [[ "${${(@s.:.)secret_keys_lines[$i]}[1]}" == "uid" ]] || [[ "${i}" -ge "${#secret_keys_lines[@]}" ]]; do + # it can be "grp" or other tokens. + # Let's iterate until we found "uid" or face an end of secret keys array + i=$((i + 1)) + done parts=("${(@s.:.)secret_keys_lines[$i]}") while [[ ${parts[1]} == "uid" ]]; do uids+=("${current_uid}") |