aboutsummaryrefslogtreecommitdiff
path: root/src/arg_defs.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2020-04-02 08:52:45 -0700
committerDaniel Mueller <deso@posteo.net>2020-04-02 08:52:45 -0700
commiteab4b20d16760043a1ec4d80d2e239fc1559bb2f (patch)
treedfee106456090e563b91135ec9ac713be94c53ea /src/arg_defs.rs
parenta3f8ae474d153048c5a9252125099ef49cc6b5f4 (diff)
downloadnitrocli-eab4b20d16760043a1ec4d80d2e239fc1559bb2f.tar.gz
nitrocli-eab4b20d16760043a1ec4d80d2e239fc1559bb2f.tar.bz2
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.
Diffstat (limited to 'src/arg_defs.rs')
-rw-r--r--src/arg_defs.rs15
1 files changed, 12 insertions, 3 deletions
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)]