fork/fish-shell

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

Johannes AltmanningerMark private functions that don't need localizationa53db7256

master
1.1 KiB32 linesraw
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.
10    set -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! !
25    b loop
26    }
27    s!^[^:]*:!!
28    s![ ]*!!g
29    y!,!\n!
30    p
31    }'
32end