Add help command

This commit is contained in:
Vincent Ollivier 2020-01-17 20:10:27 +01:00
parent aa53e7e269
commit b77422e346
3 changed files with 17 additions and 1 deletions

15
src/user/help.rs Normal file
View File

@ -0,0 +1,15 @@
use crate::{print, user};
pub fn main(_args: &[&str]) -> user::shell::ExitCode {
print!("c[opy] <file> <file> Copy file from source to destination\n");
print!("d[elete] <file> Delete file or empty directory\n");
print!("e[dit] <file> Edit existing or new file\n");
print!("h[elp] Display this text\n");
print!("l[ist] <dir> List entries in directory\n");
print!("m[ove] <file> <file> Move file from source to destination\n");
print!("p[rint] <string> Print string to screen\n");
print!("q[uit] Quit the shell\n");
print!("r[ead] <file> Read file to screen\n");
print!("w[rite] <file> Write file or directory\n");
user::shell::ExitCode::CommandSuccessful
}

View File

@ -5,6 +5,7 @@ pub mod date;
pub mod delete;
pub mod editor;
pub mod halt;
pub mod help;
pub mod hex;
pub mod list;
pub mod login;

View File

@ -191,7 +191,7 @@ impl Shell {
"e" | "edit" => user::editor::main(&args),
"f" | "find" => ExitCode::CommandUnknown,
"g" | "go" => ExitCode::CommandUnknown,
"h" | "help" => ExitCode::CommandUnknown,
"h" | "help" => user::help::main(&args),
"i" => ExitCode::CommandUnknown,
"j" | "jump" => ExitCode::CommandUnknown,
"k" | "kill" => ExitCode::CommandUnknown,