From b8ba04dcf4001163880ecd6f1aa18aea653be14a Mon Sep 17 00:00:00 2001 From: LawAbidingCactus Date: Tue, 3 Sep 2019 00:45:46 +0000 Subject: [PATCH] fix compatibility with BSD sed --- share/completions/gpg2.fish | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/share/completions/gpg2.fish b/share/completions/gpg2.fish index 4d173b965..5cb14552a 100644 --- a/share/completions/gpg2.fish +++ b/share/completions/gpg2.fish @@ -57,9 +57,19 @@ function __fish_print_gpg2_algo -d "Complete using all algorithms of the type sp # 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) + # transliterate ',' with '\n' (macOS apparently doesn't like '\n' on RHS of the s-command) # print result - gpg2 --version | sed -ne "/$argv:/"'{:loop; /,$/{N; y!\n! !; b loop}; s!^[^:]*:!!; s![ ]*!!g; y!,!\n!; p}' + # sed script must be formatted with newlines instead of semicolons to be compatible + # with BSD sed (eg, on macOS) + gpg2 --version | sed -ne "/$argv:/"'{:loop + /,$/{N; y!\n! ! + b loop + } + s!^[^:]*:!! + s![ ]*!!g + y!,!\n! + p + }' end