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