diff options
| author | Fuwn <[email protected]> | 2021-05-16 16:56:11 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-16 16:56:11 +0000 |
| commit | 25d36252f7bb49cb925446500b8a3490e498d5b0 (patch) | |
| tree | cb315f127cf824e16c7b02262f90de2f94f52442 /src | |
| parent | feat(config): optional log to file (diff) | |
| download | whirl-25d36252f7bb49cb925446500b8a3490e498d5b0.tar.xz whirl-25d36252f7bb49cb925446500b8a3490e498d5b0.zip | |
refactor(builtins): help from individual printlns to vec iterable println
Diffstat (limited to 'src')
| -rw-r--r-- | src/prompt/builtins.rs | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/prompt/builtins.rs b/src/prompt/builtins.rs index d58005a..ac22702 100644 --- a/src/prompt/builtins.rs +++ b/src/prompt/builtins.rs @@ -52,14 +52,20 @@ pub fn builtin_history(history: Vec<String>) -> i32 { } pub fn builtin_help() -> i32 { - println!("echo - display a line of predefined text"); - println!("history - display the command history"); - println!("exit - end the process"); - println!("ls - display the present files"); - println!("cat - display the contents of a present file"); - println!("config - manipulate the configuration"); - println!("help - you are here"); - println!("fetch - a neofetch like utility loosely based on rfetch"); + let helpables = vec![ + "echo - display a line of predefined text", + "history - display the command history", + "exit - end the process", + "ls - display the present files", + "cat - display the contents of a present file", + "config - manipulate the configuration", + "help - you are here", + "fetch - a neofetch like utility loosely based on rfetch", + ]; + for help in helpables { + println!("{}", help); + } + 0 } @@ -113,9 +119,14 @@ pub fn builtin_config(args: &[String]) -> i32 { match sub.as_str() { "show" => println!("{:#?}", Config::get()), "help" | "--help" | "-h" => { - println!("show - display the current configuration"); - println!("help - you are here"); - println!("refresh - reload the configuration file"); + let helpables = vec![ + "show - display the current configuration", + "help - you are here", + "refresh - reload the configuration file", + ]; + for help in helpables { + println!("{}", help); + } } "refresh" => Config::refresh(), _ => println!("invalid arguments provided"), |