Skip to main content

Module shell_parser

Module shell_parser 

Source
Expand description

Enhanced shell command parser that handles &&, ||, ;, and () operators This allows virtual commands to work properly with shell operators

Structs§

ParsedArg
Parsed argument with quote information
Redirect
Redirect information
ShellParser
Shell command parser
Token
A token with its type and original value

Enums§

ParsedCommand
Types of parsed commands
TokenType
Token types for the parser

Functions§

needs_real_shell
Check if a command needs shell features we don’t handle.
parse_shell_command
Parse a shell command with support for &&, ||, ;, and ()
remove_shell_quotes
Perform POSIX quote removal on a single already-tokenized word.
split_command_words
Split a simple command string into its words, respecting quotes and applying POSIX quote removal to each word. Operators are ignored, so this is meant for simple commands (the virtual-command dispatch path). Mirrors the JS parser’s per-argument quote removal so echo label:'help wanted' yields ["echo", "label:help wanted"] rather than splitting inside the quotes.
tokenize
Tokenize a shell command string