mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 06:03:49 +08:00
63d7386a36
Some GPG options work only with private keys but our completions suggest all keys. Modify `__fish_complete_gpg_user_id and __fish_complete_gpg_key_id` to take an optional argument for the "key type" to override `--list-keys` with like `--list-secret-keys` for the appropriate options. Closes #8712
13 lines
729 B
Fish
13 lines
729 B
Fish
# Helper function for contextual autocompletion of gpg user ids
|
|
|
|
function __fish_complete_gpg_user_id -d "Complete using gpg user ids" -a __fish_complete_gpg_command list_arg
|
|
# 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 as a description.
|
|
# It also replaces \x3a from gpg's output with colons.
|
|
#
|
|
# TODO: I tried with <EMAIL> and it worked, this was possibly fixed in gpg.
|
|
# Regardless, it's probably nicer as a description.
|
|
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'
|
|
end
|