From eab4b20d16760043a1ec4d80d2e239fc1559bb2f Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Thu, 2 Apr 2020 08:52:45 -0700 Subject: Move PinType type into arg_defs module The PinType struct, despite being intended for the pinentry module, is ultimately part of the argument handling definitions. Because our goal is to consolidate all of those in a single file, this change moves the definition of this type from the pinentry module into the newly introduced arg_defs. --- src/arg_defs.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/arg_defs.rs') diff --git a/src/arg_defs.rs b/src/arg_defs.rs index d195841..0172a81 100644 --- a/src/arg_defs.rs +++ b/src/arg_defs.rs @@ -20,7 +20,6 @@ use crate::args; use crate::commands; use crate::error::Error; -use crate::pinentry; /// Provides access to a Nitrokey device #[derive(structopt::StructOpt)] @@ -331,11 +330,21 @@ Command! {PinCommand, [ Unblock => commands::pin_unblock, ]} +/// PIN type requested from pinentry. +/// +/// The available PIN types correspond to the PIN types used by the Nitrokey devices: user and +/// admin. +#[allow(unused_doc_comments)] +Enum! {PinType, [ + Admin => "admin", + User => "user", +]} + #[derive(Debug, PartialEq, structopt::StructOpt)] pub struct PinSetArgs { /// The PIN type to change - #[structopt(name = "type", possible_values = &pinentry::PinType::all_str())] - pub pintype: pinentry::PinType, + #[structopt(name = "type", possible_values = &PinType::all_str())] + pub pintype: PinType, } #[derive(Debug, PartialEq, structopt::StructOpt)] -- cgit v1.2.1