aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/args.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-07 11:51:11 +0000
committerDaniel Mueller <deso@posteo.net>2020-01-08 09:20:30 -0800
commitb1725639a21a8661c8e8dfe30811b650abf028b0 (patch)
tree8f35d0390648777b83dc0abdde7d17f1b62fae5e /nitrocli/src/args.rs
parent5e20a29b4fdc8a2d442d1093681b396dcb4b816b (diff)
downloadnitrocli-b1725639a21a8661c8e8dfe30811b650abf028b0.tar.gz
nitrocli-b1725639a21a8661c8e8dfe30811b650abf028b0.tar.bz2
Refactor the Enum! macro into Enum! and Command!
For an easier transition to structopt, this patch splits the two cases of the Enum! macro into two separate macros (that internally both call the new enum_int! macro).
Diffstat (limited to 'nitrocli/src/args.rs')
-rw-r--r--nitrocli/src/args.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs
index 9f4cae2..0562016 100644
--- a/nitrocli/src/args.rs
+++ b/nitrocli/src/args.rs
@@ -128,7 +128,7 @@ impl From<DeviceModel> for nitrokey::Model {
/// A top-level command for nitrocli.
#[allow(unused_doc_comments)]
-Enum! {Command, [
+Command! {Command, [
Config => ("config", config),
Encrypted => ("encrypted", encrypted),
Hidden => ("hidden", hidden),
@@ -141,7 +141,7 @@ Enum! {Command, [
Unencrypted => ("unencrypted", unencrypted),
]}
-Enum! {ConfigCommand, [
+Command! {ConfigCommand, [
Get => ("get", config_get),
Set => ("set", config_set),
]}
@@ -181,7 +181,7 @@ impl<T> ConfigOption<T> {
}
}
-Enum! {OtpCommand, [
+Command! {OtpCommand, [
Clear => ("clear", otp_clear),
Get => ("get", otp_get),
Set => ("set", otp_set),
@@ -213,13 +213,13 @@ Enum! {OtpSecretFormat, [
Hex => "hex",
]}
-Enum! {PinCommand, [
+Command! {PinCommand, [
Clear => ("clear", pin_clear),
Set => ("set", pin_set),
Unblock => ("unblock", pin_unblock),
]}
-Enum! {PwsCommand, [
+Command! {PwsCommand, [
Clear => ("clear", pws_clear),
Get => ("get", pws_get),
Set => ("set", pws_set),
@@ -257,7 +257,7 @@ fn reset(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
commands::reset(ctx)
}
-Enum! {UnencryptedCommand, [
+Command! {UnencryptedCommand, [
Set => ("set", unencrypted_set),
]}
@@ -314,7 +314,7 @@ fn unencrypted_set(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
commands::unencrypted_set(ctx, mode)
}
-Enum! {EncryptedCommand, [
+Command! {EncryptedCommand, [
Close => ("close", encrypted_close),
Open => ("open", encrypted_open),
]}
@@ -364,7 +364,7 @@ fn encrypted_close(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
commands::encrypted_close(ctx)
}
-Enum! {HiddenCommand, [
+Command! {HiddenCommand, [
Close => ("close", hidden_close),
Create => ("create", hidden_create),
Open => ("open", hidden_open),