From 0382d6ab9c2a519bb2c0aa328b54ed052362a1c2 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 10 Jun 2026 21:28:13 -0400 Subject: [PATCH] feat(logging): add C5 --on-variable event handlers for real-time sync --- functions/__fish_config_logging_changed.fish | 21 ++++++++++++++++ .../__fish_config_opinionated_changed.fish | 24 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 functions/__fish_config_logging_changed.fish create mode 100644 functions/__fish_config_opinionated_changed.fish diff --git a/functions/__fish_config_logging_changed.fish b/functions/__fish_config_logging_changed.fish new file mode 100644 index 0000000..4ac19fb --- /dev/null +++ b/functions/__fish_config_logging_changed.fish @@ -0,0 +1,21 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# SYNOPSIS +# __fish_config_logging_changed +# +# DESCRIPTION +# Event handler that fires in every running shell when +# __fish_config_op_logging is set or erased. Delegates to +# __fish_config_sync_logging to update the Kitty sentinel file and +# paru/yay wrappers immediately without requiring a shell restart. +# +# RETURNS +# 0 Always +# +# EXAMPLE +# set -U __fish_config_op_logging 0 # triggers this automatically +function __fish_config_logging_changed --on-variable __fish_config_op_logging \ + --description 'C5 event handler: sync logging state when __fish_config_op_logging changes' + __fish_config_sync_logging +end diff --git a/functions/__fish_config_opinionated_changed.fish b/functions/__fish_config_opinionated_changed.fish new file mode 100644 index 0000000..40edac2 --- /dev/null +++ b/functions/__fish_config_opinionated_changed.fish @@ -0,0 +1,24 @@ +# Copyright (C) 2026 Rootiest +# SPDX-License-Identifier: AGPL-3.0-or-later + +# SYNOPSIS +# __fish_config_opinionated_changed +# +# DESCRIPTION +# Event handler that fires in every running shell when +# __fish_config_opinionated (the master opinionated switch) is set or +# erased. Delegates to __fish_config_sync_logging to keep C5 logging +# state in sync. Logging is the only category with external on-disk +# state (sentinel file, wrapper scripts) that requires real-time +# synchronisation when the master variable changes; C1-C4 guards +# evaluate at call-time and need no event handler. +# +# RETURNS +# 0 Always +# +# EXAMPLE +# set -U __fish_config_opinionated 0 # triggers this automatically +function __fish_config_opinionated_changed --on-variable __fish_config_opinionated \ + --description 'C5 event handler: sync logging state when master opinionated switch changes' + __fish_config_sync_logging +end