fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMark private functions that don't need localizationa53db7256

master
980 B22 linesraw
1# localization: skip(private)
2
3# Helper function for contextual autocompletion of GPG key ids
4function __fish_complete_gpg_key_id -d 'Complete using gpg key ids' -a __fish_complete_gpg_command list_arg
5    # Use user id as description
6    set -l keyid
7    set -q list_arg[1]; or set list_arg --list-keys
8    $__fish_complete_gpg_command $list_arg --with-colons | while read -l garbage
9        switch $garbage
10            case "uid*"
11                # Extract user ids (note: gpg escapes colons as '\x3a')
12                set -l __uid (string split ":" -- $garbage)
13                set -l uid (string replace -a '\x3a' ':' -- $__uid[10])
14                printf "%s\t%s\n" $keyid $uid
15                # NOTE key is preceded by "sec" instead of "pub" when listing secret keys
16            case "pub*" "sec*"
17                # Extract key fingerprints (no subkeys)
18                set -l __pub (string split ":" -- $garbage)
19                set keyid $__pub[5]
20        end
21    end
22end