#[repr(C)]pub struct ShellState {
pub header: fn(state: &ShellState) -> String,
pub history: Vec<String>,
pub config: Config,
pub stdin: Stdin,
pub stdout: RawTerminal<Stdout>,
/* private fields */
}
Expand description
The core shell state object. This api is WIP, and may become more locked down in the future.
Fields§
§header: fn(state: &ShellState) -> String
§history: Vec<String>
§config: Config
§stdin: Stdin
§stdout: RawTerminal<Stdout>
Implementations§
Source§impl ShellState
impl ShellState
Sourcepub fn new() -> Result<Self, ZulaError>
pub fn new() -> Result<Self, ZulaError>
Initializes a new shell. Do not use this if making plugins.
Sourcepub fn set_cwd(&mut self, path: &str) -> Result<(), ZulaError>
pub fn set_cwd(&mut self, path: &str) -> Result<(), ZulaError>
Set the current working directory of the shell. Will error if the path is not found.
Sourcepub fn get_header(&self) -> String
pub fn get_header(&self) -> String
Returns the header or “status bar.”
Sourcepub fn exec(
&mut self,
cmd: impl AsRef<str>,
args: &[impl AsRef<str>],
) -> Result<(), ZulaError>
pub fn exec( &mut self, cmd: impl AsRef<str>, args: &[impl AsRef<str>], ) -> Result<(), ZulaError>
Execute a command. Does no proccessing such as aliases, chaining, and quoting.
Sourcepub fn load_plugin(&mut self, path: impl AsRef<OsStr>) -> Result<(), Error>
pub fn load_plugin(&mut self, path: impl AsRef<OsStr>) -> Result<(), Error>
Attempt to load a plugin from a path.
Sourcepub fn plugin_lookup(&self, name: &str) -> Result<&PluginHook, ZulaError>
pub fn plugin_lookup(&self, name: &str) -> Result<&PluginHook, ZulaError>
Returns a hook to the given plugin if it exists.
Sourcepub fn plugin_names(&self) -> Keys<'_, String, PluginHook>
pub fn plugin_names(&self) -> Keys<'_, String, PluginHook>
Returns an iterator over the currently loaded plugin names.
Auto Trait Implementations§
impl Freeze for ShellState
impl !RefUnwindSafe for ShellState
impl Send for ShellState
impl Sync for ShellState
impl Unpin for ShellState
impl !UnwindSafe for ShellState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more