pub trait Shell:
Debug
+ Display
+ Send
+ Sync {
Show 14 methods
// Required methods
fn create_quoter<'a>(&self, data: Quotable<'a>) -> Quoter<'a>;
fn format(&self, statement: Statement<'_>) -> String;
fn get_config_path(&self, home_dir: &Path) -> PathBuf;
fn get_env_path(&self, home_dir: &Path) -> PathBuf;
fn get_profile_paths(&self, home_dir: &Path) -> Vec<PathBuf>;
// Provided methods
fn format_env(&self, key: &str, value: Option<&str>) -> String { ... }
fn format_env_set(&self, key: &str, value: &str) -> String { ... }
fn format_env_unset(&self, key: &str) -> String { ... }
fn format_path_prepend(&self, paths: &[String]) -> String { ... }
fn format_path_set(&self, paths: &[String]) -> String { ... }
fn format_hook(&self, hook: Hook) -> Result<String, ShellError> { ... }
fn get_env_regex(&self) -> Regex { ... }
fn get_exec_command(&self) -> ShellCommand { ... }
fn quote(&self, value: &str) -> String { ... }
}Required Methods§
Sourcefn create_quoter<'a>(&self, data: Quotable<'a>) -> Quoter<'a>
fn create_quoter<'a>(&self, data: Quotable<'a>) -> Quoter<'a>
Create a quoter for the provided string.
Sourcefn get_config_path(&self, home_dir: &Path) -> PathBuf
fn get_config_path(&self, home_dir: &Path) -> PathBuf
Return the path in which commands, aliases, and other settings will be configured.
Sourcefn get_env_path(&self, home_dir: &Path) -> PathBuf
fn get_env_path(&self, home_dir: &Path) -> PathBuf
Return the path in which environment settings will be defined.
Sourcefn get_profile_paths(&self, home_dir: &Path) -> Vec<PathBuf>
fn get_profile_paths(&self, home_dir: &Path) -> Vec<PathBuf>
Return a list of all possible profile/rc/config paths. Ordered from most to least common/applicable.
Provided Methods§
Sourcefn format_env(&self, key: &str, value: Option<&str>) -> String
fn format_env(&self, key: &str, value: Option<&str>) -> String
Format an environment variable by either setting or unsetting the value.
Sourcefn format_env_set(&self, key: &str, value: &str) -> String
fn format_env_set(&self, key: &str, value: &str) -> String
Format an environment variable that will be set to the entire shell.
Sourcefn format_env_unset(&self, key: &str) -> String
fn format_env_unset(&self, key: &str) -> String
Format an environment variable that will be unset from the entire shell.
Sourcefn format_path_prepend(&self, paths: &[String]) -> String
fn format_path_prepend(&self, paths: &[String]) -> String
Format the provided paths to prepend the PATH environment variable.
Sourcefn format_path_set(&self, paths: &[String]) -> String
fn format_path_set(&self, paths: &[String]) -> String
Format the provided paths to override the PATH environment variable.
Sourcefn format_hook(&self, hook: Hook) -> Result<String, ShellError>
fn format_hook(&self, hook: Hook) -> Result<String, ShellError>
Format a hook for the current shell.
Sourcefn get_env_regex(&self) -> Regex
fn get_env_regex(&self) -> Regex
Return a regex pattern for matching against environment variables.
Sourcefn get_exec_command(&self) -> ShellCommand
fn get_exec_command(&self) -> ShellCommand
Return parameters for executing a one-off command and then exiting.