aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/args.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-08-22 08:20:22 -0700
committerDaniel Mueller <deso@posteo.net>2019-08-22 08:20:22 -0700
commit560152b074e017753517f1d3c6e4431410ebed4b (patch)
tree3e1d13bdbe15562f15c30a1d3e8f72ac71f53a37 /nitrocli/src/args.rs
parentb766d584b36b78c96e9ef60ec927214c74ede4ab (diff)
downloadnitrocli-560152b074e017753517f1d3c6e4431410ebed4b.tar.gz
nitrocli-560152b074e017753517f1d3c6e4431410ebed4b.tar.bz2
Fix incomplete help text for encrypted & unencrypted subcommands
Subcommands of the encrypted and unencrypted commands were found to have a wrong help text displayed. The reason for that behavior was that the subargs were are constructing as part of the argument parsing process were missing the command being requested and instead containing only the subcommand. This change fixes this deficiency. It also adds a test ensuring that the "Usage" string displayed in the help text of each command and subcommand contains the proper arguments.
Diffstat (limited to 'nitrocli/src/args.rs')
-rw-r--r--nitrocli/src/args.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs
index b83c495..dfa42eb 100644
--- a/nitrocli/src/args.rs
+++ b/nitrocli/src/args.rs
@@ -286,7 +286,10 @@ fn unencrypted(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
parser.stop_on_first_argument(true);
parse(ctx, parser, args)?;
- subargs.insert(0, format!("nitrocli {}", subcommand));
+ subargs.insert(
+ 0,
+ format!("nitrocli {} {}", Command::Unencrypted, subcommand),
+ );
subcommand.execute(ctx, subargs)
}
@@ -331,7 +334,7 @@ fn encrypted(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
parser.stop_on_first_argument(true);
parse(ctx, parser, args)?;
- subargs.insert(0, format!("nitrocli {}", subcommand));
+ subargs.insert(0, format!("nitrocli {} {}", Command::Encrypted, subcommand));
subcommand.execute(ctx, subargs)
}