2019-09-24 22:31:44 +00:00
|
|
|
# Helper function for contextual autocompletion of gpg user ids
|
|
|
|
|
2022-02-09 16:40:45 +00:00
|
|
|
function __fish_complete_gpg_user_id -d "Complete using gpg user ids" -a __fish_complete_gpg_command list_arg
|
2019-09-24 22:31:44 +00:00
|
|
|
# gpg doesn't seem to like it when you use the whole key name as a
|
2020-04-18 05:58:07 +00:00
|
|
|
# completion, so we skip the <EMAIL> part and use it as a description.
|
|
|
|
# It also replaces \x3a from gpg's output with colons.
|
2021-07-14 15:30:28 +00:00
|
|
|
#
|
|
|
|
# TODO: I tried with <EMAIL> and it worked, this was possibly fixed in gpg.
|
|
|
|
# Regardless, it's probably nicer as a description.
|
2022-02-09 16:40:45 +00:00
|
|
|
set -q list_arg[1]; or set list_arg --list-keys
|
|
|
|
$__fish_complete_gpg_command $list_arg --with-colon | string split -a -f 10 : | string replace '\x3a' : | string replace -r '(.*) <(.*)>' '$1\t$2'
|
2019-09-24 22:31:44 +00:00
|
|
|
end
|