mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 19:19:58 +08:00
65883e0e40
Mostly line breaks, one instance of tabs! For some reason clang-format insists on two spaces before a same-line comment? (I continue to be unimpressed with super-strict line length limits, but I continue to believe in automatic styling, so it is what it is) [ci skip]
20 lines
789 B
Fish
20 lines
789 B
Fish
# Helper function for contextual autocompletion of GPG key ids
|
|
|
|
function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_complete_gpg_command
|
|
# Use user id as description
|
|
set -l keyid
|
|
$__fish_complete_gpg_command --list-keys --with-colons | while read garbage
|
|
switch $garbage
|
|
case "uid*"
|
|
# Extract user ids (note: gpg escapes colons as '\x3a')
|
|
set -l __uid (string split ":" -- $garbage)
|
|
set uid (string replace -a '\x3a' ':' -- $__uuid[10])
|
|
printf "%s\t%s\n" $keyid $uid
|
|
case "pub*"
|
|
# Extract key fingerprints (no subkeys)
|
|
set -l __pub (string split ":" -- $garbage)
|
|
set keyid $__pub[5]
|
|
end
|
|
end
|
|
end
|