Expand description
Shell quoting utilities for command-stream
This module provides functions for safely quoting values for shell usage, preventing command injection and ensuring proper argument handling.
Enums§
- Quote
Context - Where in a command an interpolated value lands.
Functions§
- escape_
for_ double_ quotes - Escape a value so it can sit inside
"..."as literal text. - escape_
for_ single_ quotes - Escape a value so it can sit inside
'...'as literal text. - find_
split_ template_ token - Scan a built command string for an unquoted Go/Handlebars-style template
token (
{{ ... }}) that contains an unquoted space. - has_
shell_ escapes - Detect backslash escapes that a real shell removes but the lightweight built-in command path keeps verbatim.
- is_
quote_ context_ enabled - Whether context-aware quoting is enabled.
- needs_
quoting - Check if a string needs quoting for shell usage
- quote
- Quote a value for safe shell usage
- quote_
all - Quote multiple values and join them with spaces
- quote_
for_ context - Quote a value for the context it is interpolated into.
- scan_
quote_ context - Advance the shell quoting state across a literal chunk of a template.
- warn_
on_ split_ template - Emit a one-line diagnostic when a built command contains an unquoted Go
template token with an internal space. This points users at the
shell-splitting gotcha behind the cryptic downstream errors (e.g. Go’s
“unclosed action”). Silenced via
COMMAND_STREAM_NO_TEMPLATE_WARNING, and each unique snippet is only reported once per process.