#[non_exhaustive]pub enum HookCommand {
Program {
program: String,
args: Vec<String>,
},
ShellUnchecked {
command: String,
},
}Expand description
Hook command representation.
HookCommand::Program is the safe default. It stores argv-like program
and argument values, then renders them with POSIX shell quoting (see
HookCommand::render_shell) for harnesses whose hook APIs only accept
strings. HookCommand::ShellUnchecked is an escape hatch for trusted
raw shell syntax — including the case where the target shell is not POSIX
(e.g. PowerShell on native Windows).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Program
A program plus arguments, rendered safely when a shell string is needed.
ShellUnchecked
Trusted raw shell syntax.
Implementations§
Source§impl HookCommand
impl HookCommand
Sourcepub fn program<I, S>(program: impl Into<String>, args: I) -> Self
pub fn program<I, S>(program: impl Into<String>, args: I) -> Self
Construct a safe program command.
Sourcepub fn shell_unchecked(command: impl Into<String>) -> Self
pub fn shell_unchecked(command: impl Into<String>) -> Self
Construct an unchecked raw shell command.
Sourcepub fn render_shell(&self) -> String
pub fn render_shell(&self) -> String
Render the command for harnesses whose hook contract accepts a shell command string.
The output is POSIX-shell quoted: arguments are escaped using
single-quote rules suitable for sh/bash. It is not safe for
cmd.exe or PowerShell; on native Windows, callers targeting a
non-POSIX shell should construct HookCommand::ShellUnchecked and
quote the command themselves.
Integrations that store the rendered string in a JSON or YAML field
(Copilot’s bash field, Windsurf’s bash, Gemini’s command, etc.)
inherit POSIX semantics through this method. A platform-aware shell
abstraction (ShellKind/PowerShell quoting) is intentionally
deferred; see the project README for the supported-platforms model.
Trait Implementations§
Source§impl Clone for HookCommand
impl Clone for HookCommand
Source§fn clone(&self) -> HookCommand
fn clone(&self) -> HookCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HookCommand
impl Debug for HookCommand
Source§impl PartialEq for HookCommand
impl PartialEq for HookCommand
impl Eq for HookCommand
impl StructuralPartialEq for HookCommand
Auto Trait Implementations§
impl Freeze for HookCommand
impl RefUnwindSafe for HookCommand
impl Send for HookCommand
impl Sync for HookCommand
impl Unpin for HookCommand
impl UnsafeUnpin for HookCommand
impl UnwindSafe for HookCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.