diff --git a/share/functions/__fish_complete_gpg_key_id.fish b/share/functions/__fish_complete_gpg_key_id.fish index da9c042d1..102928783 100644 --- a/share/functions/__fish_complete_gpg_key_id.fish +++ b/share/functions/__fish_complete_gpg_key_id.fish @@ -5,13 +5,15 @@ function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_co set -l keyid $__fish_complete_gpg_command --list-keys --with-colons | while read garbage switch $garbage - # Extract user ids + # Extract user ids (note: gpg escapes colons as '\x3a') case "uid*" - echo $garbage | cut -d ":" -f 10 | sed -e "s/\\\x3a/:/g" | read uid + set -l __uid (string split ":" -- $garbage) + set uid (string replace -a '\x3a' ':' -- $__uuid[10]) printf "%s\t%s\n" $keyid $uid - # Extract key fingerprints (no subkeys) + # Extract key fingerprints (no subkeys) case "pub*" - echo $garbage | cut -d ":" -f 5 | read keyid + set -l __pub (string split ":" -- $garbage) + set keyid $__pub[5] end end end