Skip to main content

claim

Function claim 

Source
pub fn claim(session_id: &str, command: &str) -> Option<CallRecord>
Expand description

Claim the record of the call this script runs: the newest one for the session whose command is command; failing that, the session’s only record. Newest, because the hook records a call just before the CLI runs it, while a call the CLI never ran (a deny rule, a refused prompt) leaves an older record behind that a retry of the same command must not take. A claim renames the record away, so two prefix processes never claim the same call. None when there is nothing to claim: the script then runs unlinked. Only a Bash call’s script, one with a command in its eval, ever claims (run).