diff --git a/share/functions/__fish_posix_quote.fish b/share/functions/__fish_posix_quote.fish new file mode 100644 index 000000000..729fae5ba --- /dev/null +++ b/share/functions/__fish_posix_quote.fish @@ -0,0 +1,11 @@ +# localization: skip(private) +function __fish_posix_quote + for arg in $argv + if set -l bareword (string match -r -- '^[-=\w]+$' $arg) + printf "%s " $bareword + continue + end + printf "'%s' " (printf %s $arg | string replace -a -- "'" "'\\''" | + string collect --no-trim-newlines) + end +end diff --git a/share/functions/fish_config.fish b/share/functions/fish_config.fish index 9448d6feb..2700a2be7 100644 --- a/share/functions/fish_config.fish +++ b/share/functions/fish_config.fish @@ -190,8 +190,11 @@ function fish_config --description "Launch fish's web based configuration" echo "Too many arguments" >&2 return 1 end - # Write the current theme in .theme format, to stdout. - set -L | string match -r (__fish_theme_variable_filter) + # Write some of the current theme in .theme format, to stdout. + for varname in (__fish_theme_variables) + __fish_posix_quote $varname $$varname + echo + end case '*' echo "No such command: $cmd" >&2 return 1