From ecedd8caed2fab50a40024d5697dae5f6c67328d Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 13 Oct 2025 20:29:30 +0200 Subject: [PATCH] fish_config theme: share logic between standalone and installed mode --- share/functions/fish_config.fish | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/share/functions/fish_config.fish b/share/functions/fish_config.fish index 25e4289d1..9d771ead8 100644 --- a/share/functions/fish_config.fish +++ b/share/functions/fish_config.fish @@ -153,8 +153,7 @@ function fish_config --description "Launch fish's web based configuration" switch $cmd case list '' - files=$dirs/*.theme string replace -r '.*/([^/]*).theme$' '$1' \ - $files (status list-files tools/web_config/themes/ 2>/dev/null) + __fish_config_list_theme_names return case demo echo -ns (set_color $fish_color_command || set_color $fish_color_normal) /bright/vixens @@ -182,15 +181,12 @@ function fish_config --description "Launch fish's web based configuration" echo case show set -l fish (status fish-path) - set -l themes \ - (dirs=$dirs __fish_config_matching tools/web_config/themes .theme $argv) set -l used_themes echo -s (set_color normal; set_color --underline) Current (set_color normal) fish_config theme demo - for t in $themes - set -l themename (string replace -r '.*/([^/]*).theme$' '$1' $t) + for themename in (__fish_config_list_theme_names $argv) contains -- $themename $used_themes and continue set -a used_themes $themename @@ -331,6 +327,16 @@ function __fish_config_list_prompts string join \n -- $prompt_paths end +function __fish_config_list_themes + set -lx dirs $__fish_config_dir/themes $__fish_data_dir/tools/web_config/themes + __fish_config_matching tools/web_config/themes .theme $argv +end + +function __fish_config_list_theme_names + __fish_config_list_themes $argv | + string replace -r '.*/([^/]*).theme$' '$1' +end + # NOTE: This outputs a mix of absolute and relative paths! function __fish_config_matching set -l prefix $argv[1]