From 609ccf89d5098c948f12175f926a682aeb2d904a Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sat, 19 Jan 2019 10:29:05 -0800 Subject: Remove args::parse_arguments function --- nitrocli/src/args.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'nitrocli/src/args.rs') 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) -> 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, -) -> Result<(Command, ExecCtx<'io>, Vec)> { +/// Parse the command-line arguments and execute the selected command. +pub(crate) fn handle_arguments(ctx: &mut RunCtx<'_>, args: Vec) -> Result<()> { let mut model: Option = 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) -> Result<()> { - let (command, mut ctx, args) = parse_arguments(ctx, args)?; - command.execute(&mut ctx, args) + command.execute(&mut ctx, subargs) } -- cgit v1.2.1