Skip to content

Commit f7d65ad

Browse files
committed
HooksMixin(feat[run_hook]): Add global_ parameter
why: Hooks set globally (with global_=True) could not be run via run_hook() because it had no way to pass -g flag to tmux. what: - Add global_: bool | None = None parameter to run_hook() - Add -g flag handling when global_ is True
1 parent 1d24014 commit f7d65ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libtmux/hooks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(self, default_hook_scope: OptionScope | None) -> None:
7272
def run_hook(
7373
self,
7474
hook: str,
75+
global_: bool | None = None,
7576
scope: OptionScope | _DefaultOptionScope | None = DEFAULT_OPTION_SCOPE,
7677
) -> Self:
7778
"""Run a hook immediately. Useful for testing."""
@@ -80,6 +81,9 @@ def run_hook(
8081

8182
flags: list[str] = ["-R"]
8283

84+
if global_ is not None and global_:
85+
flags.append("-g")
86+
8387
if scope is not None and not isinstance(scope, _DefaultOptionScope):
8488
assert scope in HOOK_SCOPE_FLAG_MAP
8589

0 commit comments

Comments
 (0)