mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
rewrite __fish_complete_gpg2_key_id to produce better output
This commit is contained in:
parent
b8ba04dcf4
commit
d4a5ef1703
1 changed files with 9 additions and 7 deletions
|
@ -28,16 +28,18 @@ function __fish_complete_gpg2_user_id -d "Complete using gpg2 user ids"
|
|||
end
|
||||
|
||||
function __fish_complete_gpg2_key_id -d 'Complete using gpg2 key ids'
|
||||
# Use user_id as the description
|
||||
set -l lastid
|
||||
# Use user id as description
|
||||
set -l keyid
|
||||
gpg2 --list-keys --with-colons | while read garbage
|
||||
switch $garbage
|
||||
# Extract user id
|
||||
case "uid*"
|
||||
echo $garbage | cut -d ":" -f 10 | sed -e "s/\\\x3a/:/g" | read lastid
|
||||
case "*"
|
||||
echo $garbage | cut -d ":" -f 5 | read fingerprint
|
||||
echo $garbage | cut -d ":" -f 10 | sed -e "s/\\\x3a/:/g" | read uid
|
||||
printf "%s\t%s\n" $keyid $uid
|
||||
# Extract key fingerprint (no subkeys)
|
||||
case "pub*"
|
||||
echo $garbage | cut -d ":" -f 5 | read keyid
|
||||
end
|
||||
printf "%s\t%s\n" $fingerprint $lastid
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue