From f3c13434e91eea3bcceaa95b86bfcd0db1ec56d4 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 25 Dec 2018 10:39:06 +0100 Subject: Implement the config get subcommand This change implements the config get subcommand. The subcommand reads the device configuration and prints it. --- nitrocli/src/args.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'nitrocli/src/args.rs') diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index 253d5a0..298b157 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -91,9 +91,9 @@ enum ConfigCommand { } impl ConfigCommand { - fn execute(&self, _args: Vec) -> Result<()> { + fn execute(&self, args: Vec) -> Result<()> { match *self { - ConfigCommand::Get => Err(Error::Error("Not implemented".to_string())), + ConfigCommand::Get => config_get(args), } } } @@ -308,6 +308,15 @@ fn config(args: Vec) -> Result<()> { subcommand.execute(subargs) } +/// Read the Nitrokey configuration. +fn config_get(args: Vec) -> Result<()> { + let mut parser = argparse::ArgumentParser::new(); + parser.set_description("Prints the Nitrokey configuration"); + parse(&parser, args)?; + + commands::config_get() +} + /// Execute an OTP subcommand. fn otp(args: Vec) -> Result<()> { let mut subcommand = OtpCommand::Get; -- cgit v1.2.1