pub fn install_block(
existing: &str,
kind: HookKind,
schema_version: u32,
) -> Result<String, HookError>Expand description
Splice klasp’s managed block into existing, returning the new file
body.
Behaviour matrix:
| Input shape | Output shape |
|---|---|
| empty / all-whitespace | <shebang>\n\n<block> (fresh-create) |
| starts with a shebang, no block | <existing>\n\n<block> (append after user content) |
| no shebang, no block | <shebang>\n\n<existing>\n\n<block> |
| contains a managed block | block contents replaced in-place |
Idempotent: when the existing block already matches the rendered block byte-for-byte and no shebang prepending was needed, the input is returned unchanged.