Expand description
Post-create and pre-remove hooks (spec §8). Hooks run via sh -c (Unix) or
cmd /C (Windows) with the new worktree as the working directory and the
WT_* variables in the environment.
Execution policy: a failed post_create is a non-fatal warning; a failed
pre_remove aborts the removal unless --force (then it is a warning).
Structs§
- Capturing
Hook Runner - A
HookRunnerthat captures the hook’s stdout/stderr instead of inheriting the terminal. Used by the TUI’s background jobs (issue #46), which keep the alternate screen up and animate a spinner — inherited hook output would otherwise paint over the rendered UI. Behaviorally identical toRealHookRunnerexcept the captured output is discarded. - Hook
Context - The context passed to a hook as
WT_*environment variables. - Real
Hook Runner - The production
HookRunnerthat spawns a shell and lets the hook inherit the terminal’s stdio (so output is visible to the user on the CLI paths, which suspend the TUI first).
Traits§
- Hook
Runner - Runs hook commands. Abstracted so tests can inject a fake.
Functions§
- run_
post_ create - Runs the
post_createhook (spec §8). A non-zero exit (or run failure) is a non-fatal warning.no_hooksor an absent command is a no-op. - run_
pre_ remove - Runs the
pre_removehook (spec §8). A non-zero exit aborts the removal unlessforceis set, in which case it is reported as a warning and removal proceeds.no_hooksor an absent command is a no-op.