fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a53db7256
master
1# localization: skip(private) 2# 3# Helper function for contextual autocompletion of GPG crypto algorithm options 4 5function __fish_print_gpg_algo -d"Complete using all algorithms of the type specified in argv[2] supported by gpg. argv[2] is a regexp" -a __fish_complete_gpg_command 6# Set a known locale, so that the output format of 'gpg --version' 7# is at least somewhat predictable. The locale will automatically 8# expire when the function goes out of scope, and the original locale 9# will take effect again. 10set -lx LC_ALL C 11 12# sed script explained: 13# in the line that matches "$argv:" 14# define label 'loop' 15# if the line ends with a ',' 16# add next line to buffer 17# transliterate '\n' with ' ' 18# goto loop 19# remove everything until the first ':' of the line 20# remove all blanks 21# transliterate ',' with '\n' (OSX apparently doesn't like '\n' on RHS of the s-command) 22# print result 23$__fish_complete_gpg_command --version| sed -ne"/ $argv [ 2 ] :/"'{:loop 24/,$/{N; y!\n! ! 25b loop 26} 27s!^[^:]*:!! 28s![ ]*!!g 29y!,!\n! 30p 31}' 32end