upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2023-09-01 00:00:00 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2023-09-13 09:24:49 +0000
commit6423baebd92e45c9be85157c443dff42e65d8d14 (patch)
tree6548edfd80d0cd9d1267378ebe816ec95e394137 /src/main.rs
parent5c5feaa732363e32e2a980a887fa42b4394b1a5e (diff)
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
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs35
1 files changed, 35 insertions, 0 deletions
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 @@
1#![cfg_attr(not(test), warn(clippy::pedantic))]
2#![cfg_attr(not(test), warn(clippy::expect_used))]
3
4use anyhow::Result;
5use clap::{Parser, Subcommand};
6
7mod cli_interactor;
8mod config;
9mod key_handling;
10mod login;
11mod sub_commands;
12
13#[derive(Parser)]
14#[command(author, version, about, long_about = None)]
15#[command(propagate_version = true)]
16pub struct Cli {
17 #[command(subcommand)]
18 command: Commands,
19 /// nsec or hex private key
20 #[arg(short, long)]
21 nsec: Option<String>,
22}
23
24#[derive(Subcommand)]
25enum Commands {
26 /// save encrypted nsec for future use
27 Login(sub_commands::login::SubCommandArgs),
28}
29
30fn main() -> Result<()> {
31 let cli = Cli::parse();
32 match &cli.command {
33 Commands::Login(args) => sub_commands::login::launch(&cli, args),
34 }
35}