From 8204d3103ba0ff403288521286ef303df42aa74b Mon Sep 17 00:00:00 2001 From: Wilke Schwiedop Date: Wed, 21 Dec 2016 01:31:55 +0100 Subject: [PATCH] fix gpg completion --- share/completions/gpg.fish | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/share/completions/gpg.fish b/share/completions/gpg.fish index 9c236e654..bb01f0ff6 100644 --- a/share/completions/gpg.fish +++ b/share/completions/gpg.fish @@ -48,8 +48,18 @@ function __fish_print_gpg_algo -d "Complete using all algorithms of the type spe # will take effect again. set -lx LC_ALL C - # XXX this misses certain ciphers in gpg --version - redo this entirely and use fish's annoying group printing as a feature finally! - gpg --version | __fish_sgrep "$argv:"| __fish_sgrep -v "Home:"|cut -d : -f 2 |tr , \n|tr -d " " + # sed script explained: + # in the line that matches "$argv:" + # define label 'loop' + # if the line ends with a ',' + # add next line to buffer + # remove '\n' and following spaces + # goto loop + # remove everything until the first ':' of the line + # remove all blanks + # transliterate ',' with '\n' (OSX apparently doesn't like '\n' on RHS of the s-command) + # print result + gpg --version | sed -ne "/$argv:/"'{:loop; /,$/{N; s!\n[ ]*! !; b loop}; s!^[^:]*:!!; s![ ]*!!g; y!,!\n!; p}' end