From 208ad95883e3590d340104b74263c2c4c696425b Mon Sep 17 00:00:00 2001 From: Rootiest Date: Wed, 9 Sep 2026 15:36:40 -0400 Subject: [PATCH] fix(config-settings): refuse to open on an empty state dump An empty dump does not fail loudly: the TUI renders every row as DEFAULT, which is indistinguishable from a config where nothing is set. That is a wrong answer rather than a missing one -- the user would be looking at ON rows reported as DEFAULT -- so the launcher now checks the dump is non-empty and bails with a message instead. The taxonomy alone guarantees output on any working checkout. Also guard a failed mktemp, which would otherwise send the dump to /state and hand an empty path to rm -rf. README: mention that / searches sub-categories across every category. --- README.md | 6 ++++-- functions/config-settings.fish | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7327b84..e9e29fe 100644 --- a/README.md +++ b/README.md @@ -331,8 +331,10 @@ Each category further sub-divides into two to six sub-categories with their own `__fish_config_op__` toggles (e.g. `__fish_config_op_aliases_filesystem`), following the exact same truthy/falsy/unset cascade one level deeper. Run `config-settings` and -press Enter on a category row to browse and toggle its sub-categories, or -see the [Components Reference](https://fish.rootiest.fyi/08-components-reference/) +press Enter on a category row to browse and toggle its sub-categories — +or press `/` and type, which searches sub-categories across every +category at once and lists the hits as `Category › Sub`. Or see the +[Components Reference](https://fish.rootiest.fyi/08-components-reference/) for the full sub-category list per category. --- diff --git a/functions/config-settings.fish b/functions/config-settings.fish index b150c94..e873f09 100644 --- a/functions/config-settings.fish +++ b/functions/config-settings.fish @@ -146,7 +146,21 @@ function config-settings --description 'Interactive TUI for managing fish config # page's `set -g` land in the caller's shell instead of in a child that is # about to exit. `command` throughout: this repo's own aliases shadow rm. set -l work (command mktemp -d) + if test -z "$work" -o ! -d "$work" + echo "$c_err""config-settings: could not create a temporary directory.$c_reset" >&2 + return 1 + end + + # An empty dump would not fail loudly -- the TUI would simply render every + # row as DEFAULT, which is indistinguishable from a config where nothing is + # set. That is a wrong answer, not a missing one, so refuse instead. The + # taxonomy alone guarantees a non-empty dump on any working checkout. __config_settings_state >$work/state + if not test -s $work/state + echo "$c_err""config-settings: __config_settings_state produced no output.$c_reset" >&2 + command rm -rf $work + return 1 + end python3 $tui --state $work/state --emit $work/edits set -l rc $status