diff options
| author | Drew Ritter <drew@primeradiant.com> | 2026-11-26 00:46:07 -0800 |
|---|---|---|
| committer | Drew Ritter <drew@primeradiant.com> | 2026-11-26 00:46:07 -0800 |
| commit | f27e901302c8294370ac77bfba148c7d72bc8b78 (patch) | |
| tree | c1db546ecef52054c5e867ba3dae1cd5c6be42a5 | |
| parent | 3cad9e246314d52dcff002668cdbfceadd80a993 (diff) | |
docs(hooks): show how to read the escaping example's resultfix/wave1-run-hook-heredoc
The example's escape_for_json, copied from hooks/session-start, leaves
its result in using_superpowers_escaped and prints nothing, but the
block shows no call, so a hook author who copies it and writes
json=$(escape_for_json "$text") gets an empty string and no error. Add
a comment after the function that says why the result is left in a
variable (capturing output with $(...) forks) and shows the call
followed by the read of the variable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | docs/windows/polyglot-hooks.md | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/windows/polyglot-hooks.md b/docs/windows/polyglot-hooks.md index 7a54aa8..d6970e1 100644 --- a/docs/windows/polyglot-hooks.md +++ b/docs/windows/polyglot-hooks.md @@ -209,6 +209,11 @@ escape_for_json() { replace_all "$escaped" "$tab" '\t' using_superpowers_escaped=$escaped } + +# The result is left in a variable instead of printed, because capturing +# output with $(...) forks. Call the function, then read the variable: +# escape_for_json "$content" +# json=$using_superpowers_escaped ``` ## Troubleshooting |
