31 lines
660 B
Rust
31 lines
660 B
Rust
use super::COMMAND_LIST;
|
|
use std::process::Command;
|
|
|
|
pub(crate) fn say_hello() {
|
|
println!("Hello, World!");
|
|
}
|
|
|
|
pub(crate) fn echo(args: Vec<String>) {
|
|
println!("{}", args.join(" "))
|
|
}
|
|
|
|
pub(crate) fn exit() {
|
|
println!("Exiting...");
|
|
std::process::exit(0)
|
|
}
|
|
|
|
pub(crate) fn clear() {
|
|
println!("Clearing screen..., running command");
|
|
let _result = if cfg!(target_os = "windows") {
|
|
Command::new("cmd").args(["/c", "cls"]).spawn()
|
|
} else {
|
|
Command::new("clear").spawn()
|
|
};
|
|
}
|
|
|
|
pub(crate) fn help() {
|
|
println!("Commands:");
|
|
for cmd in COMMAND_LIST.commands.read().iter() {
|
|
println!("{:#}", cmd);
|
|
}
|
|
}
|