diff options
author | Daniel Mueller <deso@posteo.net> | 2019-01-19 10:29:05 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-01-19 10:29:05 -0800 |
commit | 609ccf89d5098c948f12175f926a682aeb2d904a (patch) | |
tree | e471c6158993bfda783ba4691fb2ed44ca310f5b /nitrocli/src/args.rs | |
parent | 1c483530cda080b5d229a1ab3e41aefd6cdb9801 (diff) | |
download | nitrocli-609ccf89d5098c948f12175f926a682aeb2d904a.tar.gz nitrocli-609ccf89d5098c948f12175f926a682aeb2d904a.tar.bz2 |
Remove args::parse_arguments function
Diffstat (limited to 'nitrocli/src/args.rs')
-rw-r--r-- | nitrocli/src/args.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index a0ad583..55f781b 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -821,12 +821,8 @@ fn pws_status(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> { commands::pws_status(ctx, all) } -/// Parse the command-line arguments and return the selected command and -/// the remaining arguments for the command. -fn parse_arguments<'io, 'ctx: 'io>( - ctx: &'ctx mut RunCtx<'_>, - args: Vec<String>, -) -> Result<(Command, ExecCtx<'io>, Vec<String>)> { +/// Parse the command-line arguments and execute the selected command. +pub(crate) fn handle_arguments(ctx: &mut RunCtx<'_>, args: Vec<String>) -> Result<()> { let mut model: Option<DeviceModel> = None; let model_help = format!( "Select the device model to connect to ({})", @@ -866,7 +862,7 @@ fn parse_arguments<'io, 'ctx: 'io>( subargs.insert(0, format!("nitrocli {}", command)); - let ctx = ExecCtx { + let mut ctx = ExecCtx { model, stdout: ctx.stdout, stderr: ctx.stderr, @@ -877,11 +873,5 @@ fn parse_arguments<'io, 'ctx: 'io>( password: ctx.password.take(), verbosity, }; - Ok((command, ctx, subargs)) -} - -/// Parse the command-line arguments and execute the selected command. -pub(crate) fn handle_arguments(ctx: &mut RunCtx<'_>, args: Vec<String>) -> Result<()> { - let (command, mut ctx, args) = parse_arguments(ctx, args)?; - command.execute(&mut ctx, args) + command.execute(&mut ctx, subargs) } |