Browse Source

feat: print command bold

main
fdai7374 2 years ago
parent
commit
a72526dbe7
  1. 12
      src/builtins/help.rs

12
src/builtins/help.rs

@ -1,3 +1,4 @@
use colored::Colorize;
use crate::builtins::{Builtin, BuiltinConfig};
use crate::error::ShellError;
@ -19,8 +20,17 @@ impl Builtin for Help {
";
for line in commands.lines() {
println!("{}", line.trim_start());
println!("{}{}", split_command(line)[0].bold(),split_command(line)[1]);
}
Ok(())
}
}
fn split_command(commands: &str) -> Vec<&str> {
let mut splitted_command: Vec<&str> = vec![];
if !commands.is_empty() && commands.trim().len() >=1 {
splitted_command = commands.trim_start().splitn(2, " ").collect();
return splitted_command
}
return vec!["",""];
}
Loading…
Cancel
Save