fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian BoehmOptimize fish_config theme chooseb31387416

master
925 B23 linesraw
1# localization: skip(private)
2function __fish_theme_cat -a theme_name
3    set -l theme_path (__fish_theme_paths $theme_name)[1]
4    if not set -q theme_path[1]
5        echo >&2 "No such theme: $theme_name"
6        echo >&2 Searched (__fish_theme_dir) "and `status list-files themes`"
7        return 1
8    end
9    set -l theme_data (if string match -q '/*' -- $theme_path; cat $theme_path; else status get-file $theme_path; end)
10    set -l allowed_lines \
11        '\s*' \
12        '\s*#.*' \
13        '\[(dark|light|unknown)\]' \
14        (__fish_theme_variable_filter)
15    set allowed_lines "^($(string join -- '|' $allowed_lines))\$"
16    printf '%s\n' $theme_data | string match -rvq -- $allowed_lines
17    and for line in $theme_data
18        string match -rq -- $allowed_lines $theme_data
19        or printf >&2 "error: unsupported line in theme '%s': %s\n" $theme_name $line
20    end
21    string join \n $theme_data
22    true
23end