aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/args.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-05-27 08:16:27 -0700
committerDaniel Mueller <deso@posteo.net>2019-05-27 08:16:27 -0700
commitc01bbbf186cd88f9e1b3c3eda0459635bed209b4 (patch)
treed161ffd8fc36dc18ba99ff157241c6191d89c9ff /nitrocli/src/args.rs
parentb637d5284c6117da3bfeb471da7c62e53a632621 (diff)
downloadnitrocli-c01bbbf186cd88f9e1b3c3eda0459635bed209b4.tar.gz
nitrocli-c01bbbf186cd88f9e1b3c3eda0459635bed209b4.tar.bz2
Require trailing comma in Enum macro's input
The input to the Enum macro is supposed to resemble the definition of an enum in Rust code. When manually defining an enum (or a struct for that matter), we typically terminate all branches with a comma, and don't just omit that on the last line. To mirror this behavior, this change adjusts the Enum macro to accept (and in fact, require) a comma-terminated last line as well, as opposed to not accepting it as had been the case so far.
Diffstat (limited to 'nitrocli/src/args.rs')
-rw-r--r--nitrocli/src/args.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs
index 7e4f839..82e9c2a 100644
--- a/nitrocli/src/args.rs
+++ b/nitrocli/src/args.rs
@@ -104,7 +104,7 @@ impl<'io> Stdio for ExecCtx<'io> {
#[allow(unused_doc_comments)]
Enum! {DeviceModel, [
Pro => "pro",
- Storage => "storage"
+ Storage => "storage",
]}
impl From<DeviceModel> for nitrokey::Model {
@@ -126,12 +126,12 @@ Enum! {Command, [
Pws => ("pws", pws),
Reset => ("reset", reset),
Status => ("status", status),
- Storage => ("storage", storage)
+ Storage => ("storage", storage),
]}
Enum! {ConfigCommand, [
Get => ("get", config_get),
- Set => ("set", config_set)
+ Set => ("set", config_set),
]}
#[derive(Clone, Copy, Debug)]
@@ -173,17 +173,17 @@ Enum! {OtpCommand, [
Clear => ("clear", otp_clear),
Get => ("get", otp_get),
Set => ("set", otp_set),
- Status => ("status", otp_status)
+ Status => ("status", otp_status),
]}
Enum! {OtpAlgorithm, [
Hotp => "hotp",
- Totp => "totp"
+ Totp => "totp",
]}
Enum! {OtpMode, [
SixDigits => "6",
- EightDigits => "8"
+ EightDigits => "8",
]}
impl From<OtpMode> for nitrokey::OtpMode {
@@ -198,20 +198,20 @@ impl From<OtpMode> for nitrokey::OtpMode {
Enum! {OtpSecretFormat, [
Ascii => "ascii",
Base32 => "base32",
- Hex => "hex"
+ Hex => "hex",
]}
Enum! {PinCommand, [
Clear => ("clear", pin_clear),
Set => ("set", pin_set),
- Unblock => ("unblock", pin_unblock)
+ Unblock => ("unblock", pin_unblock),
]}
Enum! {PwsCommand, [
Clear => ("clear", pws_clear),
Get => ("get", pws_get),
Set => ("set", pws_set),
- Status => ("status", pws_status)
+ Status => ("status", pws_status),
]}
fn parse(
@@ -249,7 +249,7 @@ Enum! {StorageCommand, [
Close => ("close", storage_close),
Hidden => ("hidden", storage_hidden),
Open => ("open", storage_open),
- Status => ("status", storage_status)
+ Status => ("status", storage_status),
]}
/// Execute a storage subcommand.
@@ -306,7 +306,7 @@ fn storage_status(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
Enum! {HiddenCommand, [
Close => ("close", storage_hidden_close),
Create => ("create", storage_hidden_create),
- Open => ("open", storage_hidden_open)
+ Open => ("open", storage_hidden_open),
]}
/// Execute a storage hidden subcommand.