From e6d89a69521db96e27d65d8284acfa81f0ff4b2d Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Mon, 27 May 2019 09:30:46 -0700 Subject: Rename storage command to encrypted This change is the last step in the process of restructuring the storage command. In particular, now that functionality pertaining hidden volumes has been moved out into a dedicated top-level command, it renames said command to encrypted, because dealing with the encrypted volume is the only functionality it provides. --- nitrocli/src/args.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'nitrocli/src/args.rs') diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index c37e5d2..c043938 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -121,6 +121,7 @@ impl From for nitrokey::Model { #[allow(unused_doc_comments)] Enum! {Command, [ Config => ("config", config), + Encrypted => ("encrypted", encrypted), Hidden => ("hidden", hidden), Lock => ("lock", lock), Otp => ("otp", otp), @@ -128,7 +129,6 @@ Enum! {Command, [ Pws => ("pws", pws), Reset => ("reset", reset), Status => ("status", status), - Storage => ("storage", storage), ]} Enum! {ConfigCommand, [ @@ -247,18 +247,18 @@ fn reset(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { commands::reset(ctx) } -Enum! {StorageCommand, [ - Close => ("close", storage_close), - Open => ("open", storage_open), +Enum! {EncryptedCommand, [ + Close => ("close", encrypted_close), + Open => ("open", encrypted_open), ]} -/// Execute a storage subcommand. -fn storage(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { - let mut subcommand = StorageCommand::Open; +/// Execute an encrypted subcommand. +fn encrypted(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { + let mut subcommand = EncryptedCommand::Open; let help = cmd_help!(subcommand); let mut subargs = vec![]; let mut parser = argparse::ArgumentParser::new(); - parser.set_description("Interacts with the device's storage"); + parser.set_description("Interacts with the device's encrypted volume"); let _ = parser .refer(&mut subcommand) @@ -272,26 +272,26 @@ fn storage(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { parser.stop_on_first_argument(true); parse(ctx, parser, args)?; - subargs.insert(0, format!("nitrocli {} {}", Command::Storage, subcommand)); + subargs.insert(0, format!("nitrocli {}", subcommand)); subcommand.execute(ctx, subargs) } /// Open the encrypted volume on the nitrokey. -fn storage_open(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { +fn encrypted_open(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { let mut parser = argparse::ArgumentParser::new(); parser.set_description("Opens the encrypted volume on a Nitrokey Storage"); parse(ctx, parser, args)?; - commands::storage_open(ctx) + commands::encrypted_open(ctx) } /// Close the previously opened encrypted volume. -fn storage_close(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { +fn encrypted_close(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { let mut parser = argparse::ArgumentParser::new(); parser.set_description("Closes the encrypted volume on a Nitrokey Storage"); parse(ctx, parser, args)?; - commands::storage_close(ctx) + commands::encrypted_close(ctx) } Enum! {HiddenCommand, [ -- cgit v1.2.1