From 6423baebd92e45c9be85157c443dff42e65d8d14 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 1 Sep 2023 00:00:00 +0000 Subject: refactor: rebuild app skeleton Create skeleton for a complete rebuild of the prototype as a production ready product. Includes design patterns for: - dependency injection - unit testing with dependency mocking - integration testing - error handling - config storage BREAKING-CHANGE: ground-up redesign with incompatible protocol standards --- src/main.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..d16f1a3 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,35 @@ +#![cfg_attr(not(test), warn(clippy::pedantic))] +#![cfg_attr(not(test), warn(clippy::expect_used))] + +use anyhow::Result; +use clap::{Parser, Subcommand}; + +mod cli_interactor; +mod config; +mod key_handling; +mod login; +mod sub_commands; + +#[derive(Parser)] +#[command(author, version, about, long_about = None)] +#[command(propagate_version = true)] +pub struct Cli { + #[command(subcommand)] + command: Commands, + /// nsec or hex private key + #[arg(short, long)] + nsec: Option, +} + +#[derive(Subcommand)] +enum Commands { + /// save encrypted nsec for future use + Login(sub_commands::login::SubCommandArgs), +} + +fn main() -> Result<()> { + let cli = Cli::parse(); + match &cli.command { + Commands::Login(args) => sub_commands::login::launch(&cli, args), + } +} -- cgit v1.2.3