feat(guards): add opinionated component guards to config.fish and conf.d

Adds __fish_config_op_enabled helper (master __fish_config_opinionated
evaluated first via __fish_variable_check, then the category variable)
and gates C1-C4 components: CachyOS surgical override, PAGER/MANPAGER,
CDPATH, Vi mode, exit override, bang-bang bindings, history/cp/mv/wget/
grep aliases, cd->z alias, Fisher bootstrap and theme apply, paru/yay
wrapper generation, WakaTime hook, custom key chords, puffer, autopair,
starship prompt, Catppuccin colors, FZF_DEFAULT_OPTS, done notifications,
and Kitty/WezTerm window-management abbreviations.
This commit is contained in:
2026-06-10 11:28:43 -04:00
parent cdf850f2e7
commit ce84db593c
15 changed files with 386 additions and 232 deletions
+46
View File
@@ -0,0 +1,46 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# __fish_config_op_enabled <category_variable>
#
# 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.
#
# ARGUMENTS
# category_variable Name (without $) of the category opt-out variable:
# __fish_config_op_aliases, __fish_config_op_autoexec,
# __fish_config_op_overrides, or
# __fish_config_op_integrations
#
# RETURNS
# 0 Component enabled (variables truthy, unset, or unrecognized)
# 1 Component disabled (master or category variable is 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
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]
if test $status -eq 1
return 1
end
return 0
end