⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Shell

Struct Shell 

Source
pub struct Shell { /* private fields */ }
Expand description

VeridianOS Shell

Implementations§

Source§

impl Shell

Source

pub fn new() -> Self

Create a new shell

Source

pub fn run(&self) -> !

Run the shell

Source

pub fn execute_command(&self, command_line: &str) -> CommandResult

Execute a command line.

Supports &&, ||, ; operators, pipes (|), I/O redirections (>, >>, <, <<<, 2>, 2>&1), variable expansion, alias expansion, glob pattern expansion, command substitution ($(...)), and subshell grouping ((cmd1; cmd2)).

Source

pub fn init_console(&self) -> Result<(u32, u32), KernelError>

Initialize the console device by creating a PTY pair.

Creates a PTY master/slave pair via the PTY manager and optionally sets the terminal size. Shell output can then be routed through the PTY slave while falling back to serial when PTY is unavailable.

Returns Ok((master_id, slave_id)) on success.

Source

pub fn get_cwd(&self) -> String

Get current working directory

Source

pub fn set_cwd(&self, path: String) -> Result<(), KernelError>

Set current working directory

Source

pub fn get_env(&self, name: &str) -> Option<String>

Get environment variable

Source

pub fn set_env(&self, name: String, value: String)

Set environment variable

Source

pub fn get_all_env(&self) -> Vec<String>

Get all environment variables

Source

pub fn stop(&self)

Stop the shell

Source

pub fn register_builtin(&self, command: Box<dyn BuiltinCommand>)

Register a builtin command (public API for external modules)

Source

pub fn register_builtins_batch(&self, commands: Vec<Box<dyn BuiltinCommand>>)

Register multiple builtin commands at once

Trait Implementations§

Source§

impl Default for Shell

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Shell

§

impl !RefUnwindSafe for Shell

§

impl Send for Shell

§

impl Sync for Shell

§

impl Unpin for Shell

§

impl !UnwindSafe for Shell

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.