Skip to main content

Module quote

Module quote 

Source
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§

QuoteContext
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.