usage strings added to scripts

This commit is contained in:
Drew Tada 2024-02-08 13:02:12 -05:00
parent c58f010af7
commit 3471951ac7
4 changed files with 23 additions and 1 deletions

View File

@ -29,6 +29,12 @@ fn init(_our: Address) {
};
let line = String::from_utf8(args).unwrap_or("alias: error".into());
if line.is_empty() {
println!("Change alias for a process");
println!("\x1b[1mUsage:\x1b[0m alias <alias_name> <process_id>");
return;
}
let (alias, process) = line.split_once(" ").unwrap_or((&line, ""));
if alias.is_empty() {

View File

@ -19,10 +19,16 @@ fn init(_our: Address) {
};
let Ok(file_path) = String::from_utf8(args) else {
println!("bad file path");
println!("cat: bad args, aborting");
return;
};
if file_path.is_empty() {
println!("Print the contents of a file to the terminal");
println!("\x1b[1mUsage:\x1b[0m cat <file_path>");
return;
}
Request::new()
.target(("our", "vfs", "distro", "sys"))
.body(

View File

@ -19,6 +19,11 @@ fn init(our: Address) {
};
let tail = String::from_utf8(args).unwrap();
if tail.is_empty() {
println!("Send a Message to another node's terminal");
println!("\x1b[1mUsage:\x1b[0m hi <node_id> <message>");
return;
}
let (node_id, message) = match tail.split_once(" ") {
Some((s, t)) => (s, t),

View File

@ -18,6 +18,11 @@ fn init(_our: Address) {
return;
};
let body_string = String::from_utf8(body).unwrap();
if body_string.is_empty() {
println!("Send a Request to a Process");
println!("\x1b[1mUsage:\x1b[0m m <target> <body> [-a <await_time>]");
return;
}
let re = Regex::new(r#"'[^']*'|\S+"#).unwrap();
let mut args: Vec<String> = re