summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-07 11:57:06 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-07 11:57:06 -0800
commit6bb629b4d1035c3fd851244060f99da78a7bd929 (patch)
tree833f5429e85a533476a265f8d01714882133ac8f
parenta475bd6ad711fa436f0f857951a30d8e6cf4d76d (diff)
downloadnitrocli-6bb629b4d1035c3fd851244060f99da78a7bd929.tar.gz
nitrocli-6bb629b4d1035c3fd851244060f99da78a7bd929.tar.bz2
Rename Command enum to Builtin
This change renames the Command enum to Builtin. With an upcoming change we will add support for user provided functionality in the form of extensions. Those extensions integrated with nitrocli by invocable as a command such as status. By renaming the Command enum to Builtin we allow for this identifier to be used in the context of extensions in the future.
-rw-r--r--nitrocli/src/args.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs
index fe35a9e..f47f1a0 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, [
+Enum! {Builtin, [
Config => ("config", config),
Encrypted => ("encrypted", encrypted),
Hidden => ("hidden", hidden),
@@ -291,7 +291,7 @@ fn unencrypted(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
format!(
"{} {} {}",
crate::NITROCLI,
- Command::Unencrypted,
+ Builtin::Unencrypted,
subcommand,
),
);
@@ -341,7 +341,7 @@ fn encrypted(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
subargs.insert(
0,
- format!("{} {} {}", crate::NITROCLI, Command::Encrypted, subcommand),
+ format!("{} {} {}", crate::NITROCLI, Builtin::Encrypted, subcommand),
);
subcommand.execute(ctx, subargs)
}
@@ -392,7 +392,7 @@ fn hidden(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
subargs.insert(
0,
- format!("{} {} {}", crate::NITROCLI, Command::Hidden, subcommand),
+ format!("{} {} {}", crate::NITROCLI, Builtin::Hidden, subcommand),
);
subcommand.execute(ctx, subargs)
}
@@ -463,7 +463,7 @@ fn config(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
subargs.insert(
0,
- format!("{} {} {}", crate::NITROCLI, Command::Config, subcommand),
+ format!("{} {} {}", crate::NITROCLI, Builtin::Config, subcommand),
);
subcommand.execute(ctx, subargs)
}
@@ -575,7 +575,7 @@ fn otp(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
subargs.insert(
0,
- format!("{} {} {}", crate::NITROCLI, Command::Otp, subcommand),
+ format!("{} {} {}", crate::NITROCLI, Builtin::Otp, subcommand),
);
subcommand.execute(ctx, subargs)
}
@@ -746,7 +746,7 @@ fn pin(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
subargs.insert(
0,
- format!("{} {} {}", crate::NITROCLI, Command::Pin, subcommand),
+ format!("{} {} {}", crate::NITROCLI, Builtin::Pin, subcommand),
);
subcommand.execute(ctx, subargs)
}
@@ -806,7 +806,7 @@ fn pws(ctx: &mut ExecCtx<'_>, args: Vec<String>) -> Result<()> {
subargs.insert(
0,
- format!("{} {} {}", crate::NITROCLI, Command::Pws, subcommand),
+ format!("{} {} {}", crate::NITROCLI, Builtin::Pws, subcommand),
);
subcommand.execute(ctx, subargs)
}
@@ -924,7 +924,7 @@ pub(crate) fn handle_arguments(ctx: &mut RunCtx<'_>, args: Vec<String>) -> Resul
fmt_enum!(DeviceModel::all_variants())
);
let mut verbosity = 0;
- let mut command = Command::Status;
+ let mut command = Builtin::Status;
let cmd_help = cmd_help!(command);
let mut subargs = vec![];
let mut parser = argparse::ArgumentParser::new();