diff --git a/src/builtins/help.rs b/src/builtins/help.rs new file mode 100644 index 0000000..d78b5d5 --- /dev/null +++ b/src/builtins/help.rs @@ -0,0 +1,27 @@ +use crate::error::ShellError; +use crate::builtins::{Builtin, BuiltinConfig}; + + +pub struct Help; + +impl Builtin for Help { + + fn execute(&mut self, _: &mut BuiltinConfig, _: Vec) -> Result<(), ShellError> { + let commands = + "cd changes current working directory + change-prompt changes prompt style (default, bashlike, simpledirectory) + exit exits the shell + fetch prints out system information + help displays this command + ls lists contents of directory + open shows content of files + pwd shows path to current working directory + segfault exit but through segfault + sus shows amogus"; + + for line in commands.lines(){ + println!("{}",line.trim_start()); + } + Ok(()) + } +} \ No newline at end of file diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index 96913eb..51ccbe6 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -6,6 +6,7 @@ mod cd; mod change_prompt; mod exit; mod fetch; +mod help; mod ls; mod open; mod pwd; @@ -39,6 +40,7 @@ const BUILTINS: Lazy)>> = Lazy::new(|| { ("pwd", Box::new(pwd::Pwd)), ("segfault", Box::new(segfault::Segfault)), ("sus", Box::new(sus::Sus)), + ("help", Box::new(help::Help)), ] });