From cccef170310375958474b450e9dd580cc75cde24 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 10 Jun 2026 22:57:01 -0400 Subject: [PATCH 1/5] feat(guards): category variable overrides master in __fish_config_op_enabled --- functions/__fish_config_op_enabled.fish | 43 ++++++++++++++++--------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/functions/__fish_config_op_enabled.fish b/functions/__fish_config_op_enabled.fish index bc42b0b..9ea2378 100644 --- a/functions/__fish_config_op_enabled.fish +++ b/functions/__fish_config_op_enabled.fish @@ -5,14 +5,15 @@ # __fish_config_op_enabled # # DESCRIPTION -# Guard predicate for opinionated components (AGENTS.md Task #3). The master -# switch __fish_config_opinionated is always evaluated first via -# __fish_variable_check: a falsy master value (0/false/no/off/n) disables -# every category at once, regardless of the category variable's own value. -# Otherwise the supplied category variable is evaluated the same way. -# Unset or empty variables (status 2) and unrecognized values (status 3) -# leave the component enabled — opinionated components are active by -# default and these variables are pure opt-out knobs. +# Guard predicate for opinionated components (AGENTS.md Task #3). +# The category variable is evaluated first via __fish_variable_check: +# an explicit truthy value (1/true/yes/on/y) enables the component +# regardless of the master switch; an explicit falsy value +# (0/false/no/off/n) disables it regardless of the master switch. +# Only when the category variable is unset or unrecognized (status 2 +# or 3) does the master switch __fish_config_opinionated apply: a +# falsy master disables every unset-category component at once. +# Unset master with unset category → enabled (active by default). # # ARGUMENTS # category_variable Name (without $) of the category opt-out variable: @@ -23,23 +24,33 @@ # __fish_config_op_greeting # # RETURNS -# 0 Component enabled (variables truthy, unset, or unrecognized) -# 1 Component disabled (master or category variable is falsy) +# 0 Component enabled (category explicitly truthy; or category unset +# and master truthy/unset/unrecognized) +# 1 Component disabled (category explicitly falsy; or category unset +# and master explicitly falsy) # # EXAMPLE # if __fish_config_op_enabled __fish_config_op_aliases # alias grep='grep --color=auto' # end function __fish_config_op_enabled --description 'Check whether an opinionated component category is enabled' - # Master switch first: falsy disables all categories unconditionally. - __fish_variable_check __fish_config_opinionated - if test $status -eq 1 + # Category variable checked first: an explicit value takes precedence over + # the master switch in both directions. + __fish_variable_check $argv[1] + set -l cat_status $status + + # Explicitly truthy → enabled regardless of master. + if test $cat_status -eq 0 + return 0 + end + + # Explicitly falsy → disabled regardless of master. + if test $cat_status -eq 1 return 1 end - # Category variable: only an explicit falsy value disables the category. - # Truthy (0), unset/empty (2), and garbage (3) all keep it enabled. - __fish_variable_check $argv[1] + # Category unset (2) or garbage (3): fall through to master switch. + __fish_variable_check __fish_config_opinionated if test $status -eq 1 return 1 end -- 2.52.0 From 4c989a45c1e5cd99fcd4ce8fc9d11eb195934e3a Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 10 Jun 2026 22:59:11 -0400 Subject: [PATCH 2/5] refactor(guards): remove what-comments; document no-arg edge case in RETURNS --- functions/__fish_config_op_enabled.fish | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/functions/__fish_config_op_enabled.fish b/functions/__fish_config_op_enabled.fish index 9ea2378..6894882 100644 --- a/functions/__fish_config_op_enabled.fish +++ b/functions/__fish_config_op_enabled.fish @@ -24,32 +24,27 @@ # __fish_config_op_greeting # # RETURNS -# 0 Component enabled (category explicitly truthy; or category unset -# and master truthy/unset/unrecognized) -# 1 Component disabled (category explicitly falsy; or category unset -# and master explicitly falsy) +# 0 Component enabled (category explicitly truthy; or category unset and master not falsy) +# 1 Component disabled (category explicitly falsy; or category unset and master falsy) +# (no argument → category check returns 2/unset; master governs) # # EXAMPLE # if __fish_config_op_enabled __fish_config_op_aliases # alias grep='grep --color=auto' # end function __fish_config_op_enabled --description 'Check whether an opinionated component category is enabled' - # Category variable checked first: an explicit value takes precedence over - # the master switch in both directions. __fish_variable_check $argv[1] set -l cat_status $status - # Explicitly truthy → enabled regardless of master. if test $cat_status -eq 0 return 0 end - # Explicitly falsy → disabled regardless of master. if test $cat_status -eq 1 return 1 end - # Category unset (2) or garbage (3): fall through to master switch. + # Status 3 (garbage) defers to master — an unrecognized value is not an opt-out. __fish_variable_check __fish_config_opinionated if test $status -eq 1 return 1 -- 2.52.0 From c04c1a4bc2fd294146dda535fab43d44161d4752 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 10 Jun 2026 22:59:49 -0400 Subject: [PATCH 3/5] docs(guards): fold no-arg edge case into RETURNS status-1 line --- functions/__fish_config_op_enabled.fish | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/functions/__fish_config_op_enabled.fish b/functions/__fish_config_op_enabled.fish index 6894882..6eeb5b4 100644 --- a/functions/__fish_config_op_enabled.fish +++ b/functions/__fish_config_op_enabled.fish @@ -25,8 +25,7 @@ # # RETURNS # 0 Component enabled (category explicitly truthy; or category unset and master not falsy) -# 1 Component disabled (category explicitly falsy; or category unset and master falsy) -# (no argument → category check returns 2/unset; master governs) +# 1 Component disabled (category explicitly falsy; or category unset and master falsy; or no argument with falsy master) # # EXAMPLE # if __fish_config_op_enabled __fish_config_op_aliases -- 2.52.0 From a170d8208696c01f004f738d017c6c389eea036d Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 10 Jun 2026 23:00:23 -0400 Subject: [PATCH 4/5] docs(guards): document per-category master override in README Minimal Mode --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fa46345..491e97b 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ Everything opinionated in this config — command shadows, startup side-effects, | `__fish_config_op_greeting` | Per-session `fish_greeting` (suppresses distro greetings such as CachyOS fastfetch by overriding with an empty function); first-run welcome banner | | `__fish_config_opinionated` | Master switch — all six categories at once | -Set any of them to a falsy value (`0`, `false`, `no`, `off`, `n`) to disable; erase the variable to re-enable: +Set any of them to a falsy value (`0`, `false`, `no`, `off`, `n`) to disable; erase the variable to re-enable. An explicit per-category truthy value overrides a falsy master switch, so you can disable everything with `__fish_config_opinionated=0` and selectively re-enable individual categories: ```fish # Plain shell: disable everything opinionated @@ -187,8 +187,13 @@ set -U __fish_config_opinionated 0 # Or pick a single category, e.g. keep integrations but drop command shadows set -U __fish_config_op_aliases off +# Minimal mode but keep the greeting (per-category overrides master) +set -U __fish_config_opinionated 0 +set -U __fish_config_op_greeting 1 + # Back to full flavor set -Ue __fish_config_opinionated +set -Ue __fish_config_op_greeting ``` Command shadows react immediately; bindings, prompt, and abbreviations take effect in new shells. With aliases disabled, `rm` deletes permanently again instead of trashing. See `help config opinionated` for the full component list. -- 2.52.0 From e776e7fba640a2ef645402fe5d2ccedf2790353d Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 10 Jun 2026 23:02:16 -0400 Subject: [PATCH 5/5] docs(guards): document per-category master override in fish-config.md --- docs/fish-config.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/fish-config.md b/docs/fish-config.md index 4244d2b..74fc532 100644 --- a/docs/fish-config.md +++ b/docs/fish-config.md @@ -1387,6 +1387,10 @@ __fish_variable_check. Set a variable to any falsy value (0, false, no, off, n) to disable its category; erase it or set a truthy value (1, true, yes, on, y) to re-enable. Unset means enabled. +An explicit per-category truthy value takes precedence over the master +switch: setting __fish_config_opinionated=0 disables all unset categories, +but a category with an explicit truthy value remains enabled regardless. + Variable Disables ------------------------------ ------------------------------------ __fish_config_op_aliases Command shadows and flag injection: @@ -1433,6 +1437,11 @@ Examples: # Re-enable everything: set -Ue __fish_config_opinionated + # Minimal mode but keep the greeting: + set -U __fish_config_opinionated 0 + set -U __fish_config_op_greeting 1 + # (erase both to go back to full-flavor defaults) + Notes: - Command shadows (rm, cat, ls, ...) react immediately; conf.d-level -- 2.52.0