From b2cf3621b5decc0b0b0eee4ab60957f633da447b Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 6 Dec 2022 22:39:52 +0100 Subject: [PATCH] =?UTF-8?q?=C2=BBfixed=C2=AB=20scratchpad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ableos/src/scratchpad.rs | 83 +--------------------------------------- 1 file changed, 1 insertion(+), 82 deletions(-) diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index d5f49bb4..02c60d98 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -207,88 +207,7 @@ pub fn real_shell() { } pub fn command_parser(user: String, command: String) { - let mut iter = command.split_whitespace(); - - let current_path = Path::new("/home/able".to_string()); - trace!("Current path: {:?}", current_path); - let current_path = "/home/able/"; - - let bin_name = iter.next().unwrap(); - - let mut strin = String::new(); - for stri in iter.clone() { - trace!("{}", stri); - strin.push_str(stri); - } - let conf_args; - match clparse::Arguments::parse_from_string(strin) { - Ok(ok) => conf_args = ok, - Err(err) => { - println!("ERROR: {}", err); - error!("{}", err); - return; - } - }; - - match bin_name { - // note: able asked for rhaish to stay in the repo but will be removed - // in the future so just comment it out for now - // "rhai" => { - // shell(); - // } - "list" | "ls" => { - let mut vfs = VFS.lock(); - let handle = vfs.resolve(current_path).unwrap(); - let dir = vfs.fs_node(handle).unwrap(); - drop(vfs); - for dir_entry in dir.directory().unwrap() { - println!("{}", dir_entry.name()); - } - } - - "echo" => match conf_args.1.arguments.get("p") { - Some(path) => echo_file(path.to_string()), - None => println!("No path provided"), - }, - "test" => {} - "quit" => shutdown(), - "tree" => filesystem::tree("/").unwrap(), - - _ => { - let file = { - let mut vfs = VFS.lock(); - let path = format!("/home/{user}/bins/{bin_name}.wasm"); - let handle = if let Ok(file) = vfs.resolve(path) { - file - } else { - let path = format!("/shared/bins/{bin_name}.wasm"); - if let Ok(file) = vfs.resolve(path) { - file - } else { - let path = format!("/system/bins/{bin_name}.wasm"); - match vfs.resolve(path) { - Ok(file) => file, - Err(error) => { - trace!("{:?}", error); - println!("No such binary: {}", bin_name); - error!("No such binary: {}", bin_name); - return; - } - } - } - }; - - vfs.fs_node(handle).unwrap() - }; - - let mut binary = vec![]; - file.read(0, file.size(), &mut binary).unwrap(); - - let args = iter.collect::>(); - println!("{:?}", args); - run_program(&binary); - } - } + unimplemented!() } pub fn sound(n_frequency: u32) {