From 6bb629b4d1035c3fd851244060f99da78a7bd929 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Mon, 7 Jan 2019 11:57:06 -0800 Subject: 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. --- nitrocli/src/args.rs | 18 +++++++++--------- 1 file 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 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) -> Result<()> { format!( "{} {} {}", crate::NITROCLI, - Command::Unencrypted, + Builtin::Unencrypted, subcommand, ), ); @@ -341,7 +341,7 @@ fn encrypted(ctx: &mut ExecCtx<'_>, args: Vec) -> 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) -> 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) -> 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) -> 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) -> 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) -> 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) -> 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(); -- cgit v1.2.3