Stringify gpg completions

This commit is contained in:
Jason Nader 2020-01-22 01:11:36 +09:00 committed by Fabian Homborg
parent 13a26a1c65
commit 6fb545cf9b

View File

@ -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