pub struct CommandParser { /* private fields */ }Expand description
A reusable parser with parse-time expansion context.
Implementations§
Source§impl CommandParser
impl CommandParser
Sourcepub fn with_environment_value(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_environment_value( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Adds one variable to the parse-time environment expansion context.
Sourcepub fn with_format_value(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_format_value( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Adds one parse-time format variable used by %if condition expansion.
Sourcepub fn with_environment_store(self, environment: &EnvironmentStore) -> Self
pub fn with_environment_store(self, environment: &EnvironmentStore) -> Self
Copies global values from an RMUX environment store into the parser.
Sourcepub fn with_home_dir(self, home_dir: impl Into<String>) -> Self
pub fn with_home_dir(self, home_dir: impl Into<String>) -> Self
Adds the fallback home directory used for ~ expansion.
Sourcepub fn with_user_home_dir(
self,
user: impl Into<String>,
home_dir: impl Into<String>,
) -> Self
pub fn with_user_home_dir( self, user: impl Into<String>, home_dir: impl Into<String>, ) -> Self
Adds a deterministic ~user expansion mapping.
Sourcepub fn with_command_alias(
self,
definition: impl Into<String>,
) -> Result<Self, CommandParseError>
pub fn with_command_alias( self, definition: impl Into<String>, ) -> Result<Self, CommandParseError>
Adds one command-alias option entry of the form name=value.
Sourcepub fn with_command_aliases<I, S>(self, definitions: I) -> Self
pub fn with_command_aliases<I, S>(self, definitions: I) -> Self
Replaces the parser alias table with valid command-alias entries.
Sourcepub fn with_exact_commands(self, commands: &'static [CommandEntry]) -> Self
pub fn with_exact_commands(self, commands: &'static [CommandEntry]) -> Self
Adds exact-only command names to this parser.
These entries are intentionally excluded from tmux-style prefix lookup.
Use this for client-side RMUX extensions; server-side source-file
parsing should keep the frozen tmux command table.
Sourcepub fn with_max_command_bytes(self, max_command_bytes: usize) -> Self
pub fn with_max_command_bytes(self, max_command_bytes: usize) -> Self
Overrides the maximum parsed command size.
Sourcepub fn parse(&self, input: &str) -> Result<ParsedCommands, CommandParseError>
pub fn parse(&self, input: &str) -> Result<ParsedCommands, CommandParseError>
Parses a tmux command string through the tmux-style lexer.
Sourcepub fn parse_structure(
&self,
input: &str,
) -> Result<ParsedCommands, CommandParseError>
pub fn parse_structure( &self, input: &str, ) -> Result<ParsedCommands, CommandParseError>
Parses command structure without command-name lookup or alias expansion.
Source recovery uses this to find the command boundary around a lookup error without corrupting multi-line brace blocks.
Sourcepub fn parse_source_file(
&self,
input: &str,
) -> Result<ParsedCommands, CommandParseError>
pub fn parse_source_file( &self, input: &str, ) -> Result<ParsedCommands, CommandParseError>
Parses source-file/startup config text with tmux source-file comment semantics.
tmux treats any unquoted # outside condition directives as the start of
a comment, even when the next byte is {. Command strings parsed from
argv or option values keep RMUX’s historical #{...} token support; only
source-file text uses this stricter mode.
Sourcepub fn parse_source_file_structure(
&self,
input: &str,
) -> Result<ParsedCommands, CommandParseError>
pub fn parse_source_file_structure( &self, input: &str, ) -> Result<ParsedCommands, CommandParseError>
Parses source-file structure without command-name lookup or alias expansion. Recovery uses this to locate command boundaries after a lookup error while preserving source-file comment semantics.
Sourcepub fn parse_one_group(
&self,
input: &str,
) -> Result<ParsedCommands, CommandParseError>
pub fn parse_one_group( &self, input: &str, ) -> Result<ParsedCommands, CommandParseError>
Parses a tmux command string with CMD_PARSE_ONEGROUP semantics.
tmux uses this mode when a command string is parsed from an argument or option value, so embedded newlines do not create independent abort groups.
Sourcepub fn parse_arguments<I, S>(
&self,
arguments: I,
) -> Result<ParsedCommands, CommandParseError>
pub fn parse_arguments<I, S>( &self, arguments: I, ) -> Result<ParsedCommands, CommandParseError>
Parses an argv-style tmux command vector.
tmux treats these arguments as already split and only divides commands on unescaped trailing semicolons.
Sourcepub fn parse_arguments_with_assignments<I, S>(
&self,
arguments: I,
) -> Result<ParsedCommands, CommandParseError>
pub fn parse_arguments_with_assignments<I, S>( &self, arguments: I, ) -> Result<ParsedCommands, CommandParseError>
Parses an argv-style command vector for RMUX’s internal runtime bridge.
Unlike Self::parse_arguments, this recognizes one leading
name=value assignment in each command group. The direct argv parser
deliberately keeps tmux’s behavior; only the server-owned alias bridge
opts into assignment classification.
Trait Implementations§
Source§impl Clone for CommandParser
impl Clone for CommandParser
Source§fn clone(&self) -> CommandParser
fn clone(&self) -> CommandParser
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more