diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2015-08-05 22:37:19 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2015-08-05 22:38:42 +0200 |
commit | 2874650802224bbf5a31162efbef19abda76abb9 (patch) | |
tree | eda2c0b2c8f21c73ae33730b448e7495edc20175 /share/completions/gpg.fish | |
parent | 1271de321e4990ce18b3343de8719d7d1cc75ae8 (diff) |
gpg: Fix key/user id completion
This was too simplistic, among other things it completed things that
looked like key ids but weren't, didn't turn "\x3a" back into
colons (which made the argument invalid)....
gpg is weird.
Might fix #2150
Diffstat (limited to 'share/completions/gpg.fish')
-rw-r--r-- | share/completions/gpg.fish | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/share/completions/gpg.fish b/share/completions/gpg.fish index 5010be08..90e8f67e 100644 --- a/share/completions/gpg.fish +++ b/share/completions/gpg.fish @@ -23,12 +23,22 @@ function __fish_complete_gpg_user_id -d "Complete using gpg user ids" # gpg doesn't seem to like it when you use the whole key name as a # completion, so we skip the <EMAIL> part and use it a s a # description. - gpg --list-keys --with-colon|cut -d : -f 10|sed -ne 's/\(.*\) <\(.*\)>/\1'\t'\2/p' + # It also replaces colons with \x3a + gpg --list-keys --with-colon|cut -d : -f 10 | sed -ne 's/\\\x3a/:/g' -e 's/\(.*\) <\(.*\)>/\1'\t'\2/p' end function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' # Use user_id as the description - gpg --list-keys --with-colons|cut -d : -f 5,10|sed -ne "s/\(.*\):\(.*\)/\1'\t'\2/p" + set -l lastid + gpg --list-keys --with-colons | while read garbage + switch $garbage + case "uid*" + echo $garbage | cut -d ":" -f 10 | sed -e "s/\\\x3a/:/g" | read lastid + case "*" + echo $garbage | cut -d ":" -f 5 | read fingerprint + end + printf "%s\t%s\n" $fingerprint $lastid + end end function __fish_print_gpg_algo -d "Complete using all algorithms of the type specified in argv[1] supported by gpg. argv[1] is a regexp" |