From 29afe5c89f9a2df777c2782ee933b73e83cd2f8d Mon Sep 17 00:00:00 2001 From: Rootiest Date: Mon, 7 Sep 2026 20:04:26 -0400 Subject: [PATCH] refactor: use __fish_palette in the config-settings TUI 27 duplicated declarations replaced by 5 calls. Output strings untouched. Four of these five files have no --help path, so the byte-identity harness cannot reach them. Covered instead by driving the real TUI under a pty on both the baseline and converted trees with an identical paced keystroke feed (down x3, Tab, Enter, Esc, Tab, down, q): 9 redraws, 15068 bytes, byte-identical on both sides c_sel (ESC[35;1m) x9, c_hi (ESC[37;1m) x8, c_head (ESC[36;1m) x9 all four draw helpers reached -- draw, pagetab, draw_subcat ("cascade default", "(category)"), draw_value ("Allow prev") --- functions/__config_settings_draw.fish | 8 +------- functions/__config_settings_draw_subcat.fish | 7 +------ functions/__config_settings_draw_value.fish | 7 +------ functions/__config_settings_pagetab.fish | 3 +-- functions/config-settings.fish | 7 +------ 5 files changed, 5 insertions(+), 27 deletions(-) diff --git a/functions/__config_settings_draw.fish b/functions/__config_settings_draw.fish index 1d28444..6518ddd 100644 --- a/functions/__config_settings_draw.fish +++ b/functions/__config_settings_draw.fish @@ -38,13 +38,7 @@ function __config_settings_draw set -l cur_scope $argv[2] set -l vars $argv[3..] - set -l c_ok (set_color green) - set -l c_err (set_color red) - set -l c_dim (set_color brblack) - set -l c_sel (set_color --bold magenta) - set -l c_hi (set_color --bold white) - set -l c_head (set_color --bold cyan) - set -l c_reset (set_color normal) + __fish_palette set -l labels Aliases Auto-exec Overrides Integrations Logging Greeting Master diff --git a/functions/__config_settings_draw_subcat.fish b/functions/__config_settings_draw_subcat.fish index c7dccd3..e9ef166 100644 --- a/functions/__config_settings_draw_subcat.fish +++ b/functions/__config_settings_draw_subcat.fish @@ -41,12 +41,7 @@ function __config_settings_draw_subcat set -l cur_scope $argv[2] set -l category_var $argv[3] - set -l c_ok (set_color green) - set -l c_err (set_color red) - set -l c_dim (set_color brblack) - set -l c_sel (set_color --bold magenta) - set -l c_head (set_color --bold cyan) - set -l c_reset (set_color normal) + __fish_palette set -l rows (__config_settings_subcats $category_var) set -l n (count $rows) diff --git a/functions/__config_settings_draw_value.fish b/functions/__config_settings_draw_value.fish index f315056..98237e4 100644 --- a/functions/__config_settings_draw_value.fish +++ b/functions/__config_settings_draw_value.fish @@ -33,12 +33,7 @@ function __config_settings_draw_value set -l edit_mode $argv[3] set -l edit_buf $argv[4] - set -l c_ok (set_color green) - set -l c_err (set_color red) - set -l c_dim (set_color brblack) - set -l c_sel (set_color --bold magenta) - set -l c_head (set_color --bold cyan) - set -l c_reset (set_color normal) + __fish_palette # ── Page row metadata (parallel lists) ──────────────────────────────── set -l title diff --git a/functions/__config_settings_pagetab.fish b/functions/__config_settings_pagetab.fish index 024ce01..b9d5a49 100644 --- a/functions/__config_settings_pagetab.fish +++ b/functions/__config_settings_pagetab.fish @@ -27,8 +27,7 @@ function __config_settings_pagetab set -l active $argv[1] set -l iw $argv[2] - set -l c_hi (set_color --bold white) - set -l c_reset (set_color normal) + __fish_palette set -l names Universal Session Sponge Paths set -l strip ' ' diff --git a/functions/config-settings.fish b/functions/config-settings.fish index 4ac0260..18ec183 100644 --- a/functions/config-settings.fish +++ b/functions/config-settings.fish @@ -69,12 +69,7 @@ # EXAMPLE # config-settings function config-settings --description 'Interactive TUI for managing fish config settings' - set -l c_head (set_color --bold cyan) - set -l c_cmd (set_color --bold) - set -l c_flag (set_color yellow) - set -l c_dim (set_color brblack) - set -l c_err (set_color red) - set -l c_reset (set_color normal) + __fish_palette # ── Argument parsing ────────────────────────────────── for arg in $argv