diff --git a/Cargo.lock b/Cargo.lock index 7d11dc6c..52d024ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1457,7 +1457,7 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "marine" -version = "0.6.3" +version = "0.6.4" dependencies = [ "Inflector", "anyhow", diff --git a/crates/module-interface/src/interface/module_interface.rs b/crates/module-interface/src/interface/module_interface.rs index c21f4697..dc303afa 100644 --- a/crates/module-interface/src/interface/module_interface.rs +++ b/crates/module-interface/src/interface/module_interface.rs @@ -56,12 +56,12 @@ impl fmt::Display for FunctionSignature { _ => unimplemented!("more than 1 output type is unsupported"), }; - if self.arguments.is_empty() { - writeln!(f, "{}: -> {}", self.name, output) - } else { - let args = self.arguments.iter().map(|(_, ty)| ty).format(","); - writeln!(f, "{}: {} -> {}", self.name, args, output) - } + let args = self + .arguments + .iter() + .map(|(name, ty)| format!("{}: {}", name, ty)) + .format(", "); + writeln!(f, "{}({}) -> {}", self.name, args, output) } } diff --git a/tools/cli/Cargo.toml b/tools/cli/Cargo.toml index 4a4fbd19..c5b12183 100644 --- a/tools/cli/Cargo.toml +++ b/tools/cli/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "marine" description = "Fluence Marine command line tool" -version = "0.6.3" +version = "0.6.4" authors = ["Fluence Labs"] repository = "https://github.com/fluencelabs/marine/tools/cli" license = "Apache-2.0" diff --git a/tools/cli/src/args.rs b/tools/cli/src/args.rs index cb47c143..d63dc9a5 100644 --- a/tools/cli/src/args.rs +++ b/tools/cli/src/args.rs @@ -24,6 +24,7 @@ pub const IN_WASM_PATH: &str = "in-wasm-path"; pub const IT_PATH: &str = "it-path"; pub const OUT_WASM_PATH: &str = "out-wasm-path"; pub const SERVICE_NAME: &str = "service-name"; +pub const SERVICE_ID: &str = "service-id"; pub const SDK_VERSION: &str = "sdk-version"; @@ -40,7 +41,14 @@ pub fn aqua<'a, 'b>() -> App<'a, 'b> { .required(false) .takes_value(true) .short("s") + .long("service") .help("optional service name"), + Arg::with_name(SERVICE_ID) + .required(false) + .takes_value(true) + .short("i") + .long("id") + .help("optional service id"), ]) } diff --git a/tools/cli/src/main.rs b/tools/cli/src/main.rs index 58f97c1b..b469bf6a 100644 --- a/tools/cli/src/main.rs +++ b/tools/cli/src/main.rs @@ -89,20 +89,24 @@ fn aqua(args: &clap::ArgMatches<'_>) -> Result<(), anyhow::Error> { println!("{}", record); } - match args.value_of(args::SERVICE_NAME) { - Some(service_name) => println!("service {}:", service_name.to_title_case()), + let service_name = match args.value_of(args::SERVICE_NAME) { + Some(service_name) => service_name.into(), None => { let service_name = wasm_path .file_stem() .ok_or(anyhow::Error::msg("provided path isn't a path to a file"))?; - let service_name = service_name.to_string_lossy().to_title_case(); - println!("service {}:", service_name); + service_name.to_string_lossy() } + }; + let service_name = service_name.to_class_case(); + match args.value_of(args::SERVICE_ID) { + Some(id) => println!(r#"service {}("{}"):"#, service_name, id), + None => println!("service {}:", service_name), } for sign in module_interface.function_signatures { - println!(" {}", sign); + print!(" {}", sign); } Ok(())