From 103a26ffb17819ca561b20adba9de9c2ae48dc6c Mon Sep 17 00:00:00 2001 From: Jason Nader Date: Wed, 22 Jan 2020 00:00:28 +0900 Subject: [PATCH] Fix function output on FreeBSD/Cygwin systems --- share/functions/__fish_print_encodings.fish | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_print_encodings.fish b/share/functions/__fish_print_encodings.fish index f5507d882..3cdd5d530 100644 --- a/share/functions/__fish_print_encodings.fish +++ b/share/functions/__fish_print_encodings.fish @@ -1,3 +1,8 @@ function __fish_print_encodings -d "Complete using available character encodings" - iconv --list | sed -e 's|//||' + if iconv --usage &>/dev/null # only GNU has this flag + # Note: GNU iconv changes its output to contain the forward slashes below when stdout is not a tty. + iconv --list | string replace -ra '//' '' + else # non-GNU + iconv --list | string replace -ra '\s+' '\n' + end end