diff options
Diffstat (limited to 'nitrocli/src/args.rs')
-rw-r--r-- | nitrocli/src/args.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index e7e7717..e533c82 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -286,7 +286,7 @@ fn parse(parser: &argparse::ArgumentParser<'_>, args: Vec<String>) -> Result<()> /// Inquire the status of the nitrokey. fn status(args: Vec<String>) -> Result<()> { let mut parser = argparse::ArgumentParser::new(); - parser.set_description("Print the status of the connected Nitrokey device"); + parser.set_description("Prints the status of the connected Nitrokey device"); parse(&parser, args)?; commands::status() @@ -296,6 +296,7 @@ fn status(args: Vec<String>) -> Result<()> { enum StorageCommand { Close, Open, + Status, } impl StorageCommand { @@ -303,6 +304,7 @@ impl StorageCommand { match *self { StorageCommand::Close => storage_close(args), StorageCommand::Open => storage_open(args), + StorageCommand::Status => storage_status(args), } } } @@ -315,6 +317,7 @@ impl fmt::Display for StorageCommand { match *self { StorageCommand::Close => "close", StorageCommand::Open => "open", + StorageCommand::Status => "status", } ) } @@ -327,6 +330,7 @@ impl str::FromStr for StorageCommand { match s { "close" => Ok(StorageCommand::Close), "open" => Ok(StorageCommand::Open), + "status" => Ok(StorageCommand::Status), _ => Err(()), } } @@ -374,6 +378,15 @@ fn storage_close(args: Vec<String>) -> Result<()> { commands::storage_close() } +/// Print the status of the nitrokey's storage. +fn storage_status(args: Vec<String>) -> Result<()> { + let mut parser = argparse::ArgumentParser::new(); + parser.set_description("Prints the status of the Nitrokey's storage"); + parse(&parser, args)?; + + commands::storage_status() +} + /// Clear the PIN as cached by various other commands. fn clear(args: Vec<String>) -> Result<()> { let mut parser = argparse::ArgumentParser::new(); |