feat(config): add sub-category granularity to opinionated components #107

Merged
rootiest merged 30 commits from worktree-opinionated-subcategories into main 2026-08-19 01:42:26 +00:00
6 changed files with 45 additions and 13 deletions
Showing only changes of commit 040c98c0a7 - Show all commits
+2
View File
@@ -11,6 +11,8 @@ on:
- "docs/verify-manual.py"
- "docs/site/**"
- "functions/**"
- "conf.d/**"
- "config.fish"
workflow_dispatch:
jobs:
+1 -1
View File
@@ -105,7 +105,7 @@ def main() -> int:
for w in warnings:
print(f" WARN {w}", file=sys.stderr)
OUTPUT.write_text(render(registry))
print(f"wrote {OUTPUT} ({len(registry)} entries)")
print(f"wrote {OUTPUT} ({len(registry)} entries)", file=sys.stderr)
return 0
+16 -5
View File
@@ -131,11 +131,9 @@ def _parsed_functions() -> dict[str, dict[str, list[str]]]:
def _parsed_components() -> dict[str, list[str]]:
repo = Path(__file__).parent.parent
out = mt.parse_components(repo / "functions")
out.update(mt.parse_components(repo / "conf.d"))
out.update(mt.parse_component_file(repo / "config.fish"))
return out
import generate_component_registry as gcr
return gcr.collect_components()
_C0_TAGS = {"always/on", "always/off"}
@@ -1123,6 +1121,19 @@ def test_build_manual_regenerates_registry_before_building():
)
def test_committed_registry_matches_headers():
"""The committed conf.d/__fish_config_op_registry.fish must match what
generate_component_registry.py would produce right now from the current
`# COMPONENT` headers -- otherwise CI has nothing catching drift."""
import generate_component_registry as gcr
registry, _ = gcr.build_registry(gcr.collect_components())
assert gcr.render(registry) == gcr.OUTPUT.read_text(), (
"conf.d/__fish_config_op_registry.fish is stale — run "
"__fish_config_op_registry_rebuild"
)
TESTS = [v for k, v in sorted(globals().items()) if k.startswith("test_")]
+1 -1
View File
@@ -182,7 +182,7 @@ function __config_settings_draw
# ── Keybind hint ──────────────────────────────────────────────────────
# string pad is width-aware (arrows count as 1 column)
set -l hint " ↑↓/kj move ←→/hl set Tab page q quit"
set -l hint " ↑↓/kj move ←→/hl set Enter sub-cats Tab pg q quit"
printf '%s│%s%s%s│\n' $p $c_dim (string pad -r -w $iw -- $hint) $c_reset
# ── Bottom border ─────────────────────────────────────────────────────
+13 -3
View File
@@ -71,9 +71,19 @@ function __config_settings_draw_subcat
set -l desc_w (math $iw - 34)
set -l cat_label (string replace -r '^__fish_config_op_' '' -- $category_var)
set -l title_dashes (math $iw - (string length -- $cat_label) - 19)
printf '%s┌─%s Sub-categories: %s %s┐\n' \
$p $c_head "$cat_label$c_reset" (string repeat -n (math "max(0, $title_dashes)") '─')
# Scope indicator: toggling a row on this page writes -U (Universal,
# persistent) or -g (Session, this-shell-only) -- the title must say
# which, since it isn't otherwise visible anywhere on the page.
set -l scope_label Universal
test "$cur_scope" = session; and set scope_label Session
# Title layout is "┌─ Sub-categories: <label> (<scope>) ───┐"; the
# dash count must absorb every visible char added around cat_label so
# the line still totals iw+2, matching the surrounding box exactly --
# see the DESCRIPTION doc comment above for why this is hand-verified,
# not eyeballed.
set -l title_dashes (math $iw - (string length -- $cat_label) - (string length -- $scope_label) - 22)
printf '%s┌─%s Sub-categories: %s (%s)%s %s┐\n' \
$p $c_head "$cat_label" $scope_label "$c_reset" (string repeat -n (math "max(0, $title_dashes)") '─')
printf '%s│%s│\n' $p $HBR
+12 -3
View File
@@ -20,7 +20,10 @@
# path, and the user-dots convenience symlink toggle (Dots link)
#
# Toggle rows use ← / → (or h / l) to step OFF ← DEFAULT → ON; DEFAULT erases
# the variable so the master switch / built-in default applies. Value rows
# the variable so the master switch / built-in default applies. On the
# Universal/Session pages, Enter on a category row (C1C6) opens that
# category's sub-category drill-down page for finer-grained toggles;
# Escape backs out to the category list. Value rows
# (Sponge, Paths) use Enter to edit inline; ← / h clears to default. List rows
# (e.g. Extra secret, OK codes) accept values separated by commas and/or
# whitespace — "A, B", "A,B" and "A B" all yield the same two entries.
@@ -49,7 +52,10 @@
# ↑ ↓ / k j Move cursor
# ← → / h l Toggle rows: OFF ← DEFAULT → ON
# ← / h Value rows: clear to default
# Enter Value rows: edit inline (Sponge / Paths pages)
# Enter Category rows (Universal/Session): open sub-category
# drill-down page. Value rows: edit inline (Sponge /
# Paths pages)
# Escape Sub-category page: back out to the category list
# Tab / S-Tab Next / previous page
# q / Escape Exit
#
@@ -82,7 +88,8 @@ function config-settings --description 'Interactive TUI for managing fish config
echo "$c_head""Navigation:$c_reset"
echo " $c_flag↑ ↓$c_reset or $c_flag""k j$c_reset Move cursor up / down"
echo " $c_flag← →$c_reset or $c_flag""h l$c_reset Toggle pages: OFF ← DEFAULT → ON"
echo " $c_flag""Enter$c_reset Edit value (Sponge / Paths pages)"
echo " $c_flag""Enter$c_reset Open sub-category page (Universal / Session);"
echo " edit value (Sponge / Paths pages)"
echo " $c_flag← / h$c_reset Clear value to default (value rows)"
echo " $c_flag""Tab / S-Tab$c_reset Next / previous page"
echo " $c_flag""q$c_reset / $c_flag""Esc$c_reset Exit"
@@ -216,9 +223,11 @@ function config-settings --description 'Interactive TUI for managing fish config
case tab
set cur_page (math "($cur_page + 1) % 4")
set cur_row 0
set in_subcat 0
case backtab
set cur_page (math "($cur_page + 3) % 4")
set cur_row 0
set in_subcat 0
case right l
if test $cur_page -le 1
# Toggle page: step toward ON