diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-26 10:29:33 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-26 10:36:58 +0100 |
| commit | 0134ab8eb413b8b81ec8e179897ddb8ea63e134e (patch) | |
| tree | 1d3ef8786fa806a4d39378286c68cda722cc017d /src/main.rs | |
| parent | 52f9efa50f81142da013c4da5f3cd3091e07916b (diff) | |
feat(remote): add nostr git remote helper
as a simple proxy to the first git server listed in announcement
parse clone url as `nostr://naddr123...`
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/src/main.rs b/src/main.rs index 81eaf2f..add26f1 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -3,8 +3,10 @@ | |||
| 3 | #![cfg_attr(not(test), warn(clippy::expect_used))] | 3 | #![cfg_attr(not(test), warn(clippy::expect_used))] |
| 4 | 4 | ||
| 5 | use anyhow::Result; | 5 | use anyhow::Result; |
| 6 | use clap::{Parser, Subcommand}; | 6 | use clap::Parser; |
| 7 | use cli::{Cli, Commands}; | ||
| 7 | 8 | ||
| 9 | mod cli; | ||
| 8 | mod cli_interactor; | 10 | mod cli_interactor; |
| 9 | mod client; | 11 | mod client; |
| 10 | mod config; | 12 | mod config; |
| @@ -14,47 +16,6 @@ mod login; | |||
| 14 | mod repo_ref; | 16 | mod repo_ref; |
| 15 | mod sub_commands; | 17 | mod sub_commands; |
| 16 | 18 | ||
| 17 | #[derive(Parser)] | ||
| 18 | #[command(author, version, about, long_about = None)] | ||
| 19 | #[command(propagate_version = true)] | ||
| 20 | pub struct Cli { | ||
| 21 | #[command(subcommand)] | ||
| 22 | command: Commands, | ||
| 23 | /// remote signer address | ||
| 24 | #[arg(long, global = true)] | ||
| 25 | bunker_uri: Option<String>, | ||
| 26 | /// remote signer app secret key | ||
| 27 | #[arg(long, global = true)] | ||
| 28 | bunker_app_key: Option<String>, | ||
| 29 | /// nsec or hex private key | ||
| 30 | #[arg(short, long, global = true)] | ||
| 31 | nsec: Option<String>, | ||
| 32 | /// password to decrypt nsec | ||
| 33 | #[arg(short, long, global = true)] | ||
| 34 | password: Option<String>, | ||
| 35 | /// disable spinner animations | ||
| 36 | #[arg(long, action)] | ||
| 37 | disable_cli_spinners: bool, | ||
| 38 | } | ||
| 39 | |||
| 40 | #[derive(Subcommand)] | ||
| 41 | enum Commands { | ||
| 42 | /// update cache with latest updates from nostr | ||
| 43 | Fetch(sub_commands::fetch::SubCommandArgs), | ||
| 44 | /// signal you are this repo's maintainer accepting proposals via nostr | ||
| 45 | Init(sub_commands::init::SubCommandArgs), | ||
| 46 | /// issue commits as a proposal | ||
| 47 | Send(sub_commands::send::SubCommandArgs), | ||
| 48 | /// list proposals; checkout, apply or download selected | ||
| 49 | List, | ||
| 50 | /// send proposal revision | ||
| 51 | Push(sub_commands::push::SubCommandArgs), | ||
| 52 | /// fetch and apply new proposal commits / revisions linked to branch | ||
| 53 | Pull, | ||
| 54 | /// run with --nsec flag to change npub | ||
| 55 | Login(sub_commands::login::SubCommandArgs), | ||
| 56 | } | ||
| 57 | |||
| 58 | #[tokio::main] | 19 | #[tokio::main] |
| 59 | async fn main() -> Result<()> { | 20 | async fn main() -> Result<()> { |
| 60 | let cli = Cli::parse(); | 21 | let cli = Cli::parse(); |