mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03:00
fish_config theme dump: speed up
For better or worse, "set -L" prints all of $history, which makes "fish_config theme show" very slow. Fix this by only printing the relevant variables. While at, make the escaping function use the shared subset of fish and POSIX shell quoting syntax, to allow a following commit to use shlex.split().
This commit is contained in:
11
share/functions/__fish_posix_quote.fish
Normal file
11
share/functions/__fish_posix_quote.fish
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user