From 28691d9c9c2b4842bcbc8ceb27b1db875f2d749b Mon Sep 17 00:00:00 2001 From: James Hugman Date: Fri, 18 Aug 2023 19:59:26 +0100 Subject: [PATCH] Address reviewer comments --- .../support/nimbus-cli/src/output/fml_cli.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/support/nimbus-cli/src/output/fml_cli.rs b/components/support/nimbus-cli/src/output/fml_cli.rs index eb946982d..2552a6d44 100644 --- a/components/support/nimbus-cli/src/output/fml_cli.rs +++ b/components/support/nimbus-cli/src/output/fml_cli.rs @@ -13,18 +13,22 @@ use nimbus_fml::command_line::do_main; pub(crate) fn fml_cli(args: &Vec, cwd: &Path) -> Result { // We prepend the string `nimbus-cli fml` to the args to pass to FML - // because the clap uses the 0th argument for help messages. + // because the clap uses the 0th argument for help messages; so the FML's command line processor + // will report an error with a usage message of `nimbus-cli fml generate [FLAGS] INPUT OUTPUT`. let first = OsStr::new("nimbus-cli fml").to_os_string(); let mut cli_args = vec![&first]; - // To make this a little more ergonomic, if the user has just typed - // `nimbus-cli fml`, then we can help them a little bit. let help = OsStr::new("--help").to_os_string(); if args.is_empty() { + // If the user has just typed `nimbus-cli fml`– with no furher arguments— then the rather unhelpful message + // `not implemented: Command not implemented` is displayed. This will change if and when we upgrade the nimbus-fml + // to use cli-derive, but until then, we can do a simple thing to make the experience a bit nicer, by adding + // the `--help` flag, so the user gets the nimbus-fml command line help. cli_args.push(&help); - } else { - cli_args.extend(args); } + + // Finally, send all the args after `nimbus-cli fml` verbatim to the FML clap cli. + cli_args.extend(args); do_main(cli_args, cwd)?; Ok(true) }