diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 8134284..453a46c 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -11,6 +11,8 @@ on: - "docs/verify-manual.py" - "docs/site/**" - "functions/**" + - "conf.d/**" + - "config.fish" workflow_dispatch: jobs: diff --git a/docs/generate_component_registry.py b/docs/generate_component_registry.py index 2c0b572..60d4381 100644 --- a/docs/generate_component_registry.py +++ b/docs/generate_component_registry.py @@ -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 diff --git a/docs/verify-manual.py b/docs/verify-manual.py index 2963de4..a8675f7 100644 --- a/docs/verify-manual.py +++ b/docs/verify-manual.py @@ -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_")] diff --git a/functions/__config_settings_draw.fish b/functions/__config_settings_draw.fish index 077081b..1d28444 100644 --- a/functions/__config_settings_draw.fish +++ b/functions/__config_settings_draw.fish @@ -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 ───────────────────────────────────────────────────── diff --git a/functions/__config_settings_draw_subcat.fish b/functions/__config_settings_draw_subcat.fish index 30eddce..c7dccd3 100644 --- a/functions/__config_settings_draw_subcat.fish +++ b/functions/__config_settings_draw_subcat.fish @@ -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: