From 572dce6a76a77cbf9ba768cf91b6ec49cfc008a4 Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 5 Feb 2021 01:08:16 +0300 Subject: [PATCH] add shortcauts and fix error messages --- Cargo.lock | 2 +- tools/repl/Cargo.toml | 2 +- tools/repl/src/repl.rs | 38 +++++++++++++++++++------------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ab2e2f46..f4da90f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -898,7 +898,7 @@ dependencies = [ [[package]] name = "frepl" -version = "0.1.32" +version = "0.1.33" dependencies = [ "anyhow", "clap", diff --git a/tools/repl/Cargo.toml b/tools/repl/Cargo.toml index 24ad0d10..0d8824bc 100644 --- a/tools/repl/Cargo.toml +++ b/tools/repl/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "frepl" description = "Fluence FCE REPL intended for testing purposes" -version = "0.1.32" +version = "0.1.33" authors = ["Fluence Labs"] repository = "https://github.com/fluencelabs/fce/tools/repl" license = "Apache-2.0" diff --git a/tools/repl/src/repl.rs b/tools/repl/src/repl.rs index 9bd5a713..bfcce666 100644 --- a/tools/repl/src/repl.rs +++ b/tools/repl/src/repl.rs @@ -53,13 +53,13 @@ impl REPL { /// Returns true, it should be the last executed command. pub fn execute<'args>(&mut self, mut args: impl Iterator) -> bool { match args.next() { - Some("new") => self.new_service(args), - Some("load") => self.load_module(args), - Some("unload") => self.unload_module(args), - Some("call") => self.call_module(args), - Some("envs") => self.show_envs(args), - Some("fs") => self.show_fs(args), - Some("interface") => self.show_interface(), + Some("n") | Some("new") => self.new_service(args), + Some("l") | Some("load") => self.load_module(args), + Some("u") | Some("unload") => self.unload_module(args), + Some("c") | Some("call") => self.call_module(args), + Some("e") | Some("envs") => self.show_envs(args), + Some("f") | Some("fs") => self.show_fs(args), + Some("i") | Some("interface") => self.show_interface(), Some("q") | Some("quit") => { return false; } @@ -106,7 +106,7 @@ impl REPL { elapsed_time ) } - Err(e) => format!("module loaded failed with: {:?}", e), + Err(e) => format!("loading failed with: {}", e), }; println!("{}", result_msg); } @@ -123,7 +123,7 @@ impl REPL { elapsed_time ) } - Err(e) => format!("module unloaded failed with: {:?}", e), + Err(e) => format!("unloading failed with: {}", e), }; println!("{}", result_msg); } @@ -155,7 +155,7 @@ impl REPL { let elapsed_time = start.elapsed(); format!("result: {:?}\n elapsed time: {:?}", result, elapsed_time) } - Err(e) => format!("execution failed with {:?}", e), + Err(e) => format!("call failed with: {}", e), }; println!("{}", result); @@ -211,14 +211,14 @@ impl REPL { fn print_help() { println!( "Commands:\n\n\ - new [config_path] create a new service (current will be removed)\n\ - load load a new Wasm module\n\ - unload unload a Wasm module\n\ - call [args] call function with given name from given module\n\ - interface print public interface of all loaded modules\n\ - envs print environment variables of a module\n\ - fs print filesystem state of a module\n\ - h/help print this message\n\ - q/quit/Ctrl-C exit" + n/new [config_path] create a new service (current will be removed)\n\ + l/load load a new Wasm module\n\ + u/unload unload a Wasm module\n\ + c/call [args] call function with given name from given module\n\ + i/interface print public interface of all loaded modules\n\ + e/envs print environment variables of a module\n\ + f/fs print filesystem state of a module\n\ + h/help print this message\n\ + q/quit/Ctrl-C exit" ); }