From 4d1e264e8c2cbff570ca7ff3be14e012c90391c4 Mon Sep 17 00:00:00 2001 From: fdai7374 Date: Sat, 28 Jan 2023 19:08:27 +0100 Subject: [PATCH] refactoring: format help command --- src/builtins/help.rs | 8 +++----- src/builtins/mod.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/builtins/help.rs b/src/builtins/help.rs index d78b5d5..4fbe17e 100644 --- a/src/builtins/help.rs +++ b/src/builtins/help.rs @@ -1,11 +1,9 @@ -use crate::error::ShellError; use crate::builtins::{Builtin, BuiltinConfig}; - +use crate::error::ShellError; pub struct Help; impl Builtin for Help { - fn execute(&mut self, _: &mut BuiltinConfig, _: Vec) -> Result<(), ShellError> { let commands = "cd changes current working directory @@ -19,8 +17,8 @@ impl Builtin for Help { segfault exit but through segfault sus shows amogus"; - for line in commands.lines(){ - println!("{}",line.trim_start()); + for line in commands.lines() { + println!("{}", line.trim_start()); } Ok(()) } diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index 51ccbe6..2da1a20 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -35,12 +35,12 @@ const BUILTINS: Lazy)>> = Lazy::new(|| { ("change-prompt", Box::new(change_prompt::ChangePrompt)), ("exit", Box::new(exit::Exit)), ("fetch", Box::new(fetch::Fetch)), + ("help", Box::new(help::Help)), ("ls", Box::new(ls::Ls)), ("open", Box::new(open::Open)), ("pwd", Box::new(pwd::Pwd)), ("segfault", Box::new(segfault::Segfault)), ("sus", Box::new(sus::Sus)), - ("help", Box::new(help::Help)), ] });