mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
rewrite __fish_complete_gpg_key_id to produce better output
This commit is contained in:
parent
8e0aa03c4a
commit
d2e9ee290c
|
@ -21,23 +21,25 @@
|
||||||
|
|
||||||
function __fish_complete_gpg_user_id -d "Complete using gpg user ids"
|
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
|
# 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
|
# completion, so we skip the <EMAIL> part and use it as a
|
||||||
# description.
|
# description.
|
||||||
# It also replaces colons with \x3a
|
# 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'
|
gpg --list-keys --with-colon | cut -d : -f 10 | sed -ne 's/\\\x3a/:/g' -e 's/\(.*\) <\(.*\)>/\1'\t'\2/p'
|
||||||
end
|
end
|
||||||
|
|
||||||
function __fish_complete_gpg_key_id -d 'Complete using gpg key ids'
|
function __fish_complete_gpg_key_id -d 'Complete using gpg key ids'
|
||||||
# Use user_id as the description
|
# Use user id as description
|
||||||
set -l lastid
|
set -l keyid
|
||||||
gpg --list-keys --with-colons | while read garbage
|
gpg --list-keys --with-colons | while read garbage
|
||||||
switch $garbage
|
switch $garbage
|
||||||
|
# Extract user ids
|
||||||
case "uid*"
|
case "uid*"
|
||||||
echo $garbage | cut -d ":" -f 10 | sed -e "s/\\\x3a/:/g" | read lastid
|
echo $garbage | cut -d ":" -f 10 | sed -e "s/\\\x3a/:/g" | read uid
|
||||||
case "*"
|
printf "%s\t%s\n" $keyid $uid
|
||||||
echo $garbage | cut -d ":" -f 5 | read fingerprint
|
# Extract key fingerprints (no subkeys)
|
||||||
|
case "pub*"
|
||||||
|
echo $garbage | cut -d ":" -f 5 | read keyid
|
||||||
end
|
end
|
||||||
printf "%s\t%s\n" $fingerprint $lastid
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user