diff options
| -rw-r--r-- | nostr_git_remote_helper/Cargo.toml | 16 | ||||
| -rw-r--r-- | nostr_git_remote_helper/src/main.rs | 31 | ||||
| -rw-r--r-- | nostr_git_remote_helper/src/sub_commands/mod.rs | 1 | ||||
| -rw-r--r-- | nostr_git_remote_helper/src/sub_commands/placeholder.rs | 10 |
4 files changed, 58 insertions, 0 deletions
diff --git a/nostr_git_remote_helper/Cargo.toml b/nostr_git_remote_helper/Cargo.toml new file mode 100644 index 0000000..b45c303 --- /dev/null +++ b/nostr_git_remote_helper/Cargo.toml | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | [package] | ||
| 2 | name = "nostr-git-remote-helper" | ||
| 3 | version = "0.0.1" | ||
| 4 | edition = "2021" | ||
| 5 | description = "git remote helper for nostr protocol" | ||
| 6 | authors = ["DanConwayDev <DanConwayDev@protonmail.com>"] | ||
| 7 | readme = "README.md" | ||
| 8 | license = "MIT" | ||
| 9 | keywords = ["nostr", "git"] | ||
| 10 | categories = ["command-line-utilities","git", "git-remote-helper"] | ||
| 11 | |||
| 12 | [dependencies] | ||
| 13 | anyhow = "1.0.75" | ||
| 14 | clap = { version = "4.3.19", features = ["derive"] } | ||
| 15 | futures = "0.3.28" | ||
| 16 | tokio = "1.33.0" | ||
diff --git a/nostr_git_remote_helper/src/main.rs b/nostr_git_remote_helper/src/main.rs new file mode 100644 index 0000000..05e3fab --- /dev/null +++ b/nostr_git_remote_helper/src/main.rs | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #![cfg_attr(not(test), warn(clippy::pedantic))] | ||
| 2 | #![cfg_attr(not(test), warn(clippy::expect_used))] | ||
| 3 | |||
| 4 | use anyhow::Result; | ||
| 5 | use clap::{Parser, Subcommand}; | ||
| 6 | |||
| 7 | mod sub_commands; | ||
| 8 | |||
| 9 | #[derive(Parser)] | ||
| 10 | #[command(author, version, about, long_about = None)] | ||
| 11 | #[command(propagate_version = true)] | ||
| 12 | pub struct Cli { | ||
| 13 | #[command(subcommand)] | ||
| 14 | command: Commands, | ||
| 15 | } | ||
| 16 | |||
| 17 | #[derive(Subcommand)] | ||
| 18 | enum Commands { | ||
| 19 | /// replace with an actual subcommand | ||
| 20 | Placeholder(sub_commands::placeholder::SubCommandArgs), | ||
| 21 | } | ||
| 22 | |||
| 23 | #[tokio::main] | ||
| 24 | async fn main() -> Result<()> { | ||
| 25 | let cli = Cli::parse(); | ||
| 26 | match &cli.command { | ||
| 27 | Commands::Placeholder(args) => { | ||
| 28 | futures::executor::block_on(sub_commands::placeholder::launch(&cli, args)) | ||
| 29 | } | ||
| 30 | } | ||
| 31 | } | ||
diff --git a/nostr_git_remote_helper/src/sub_commands/mod.rs b/nostr_git_remote_helper/src/sub_commands/mod.rs new file mode 100644 index 0000000..b12a94a --- /dev/null +++ b/nostr_git_remote_helper/src/sub_commands/mod.rs | |||
| @@ -0,0 +1 @@ | |||
| pub mod placeholder; | |||
diff --git a/nostr_git_remote_helper/src/sub_commands/placeholder.rs b/nostr_git_remote_helper/src/sub_commands/placeholder.rs new file mode 100644 index 0000000..ebe05ff --- /dev/null +++ b/nostr_git_remote_helper/src/sub_commands/placeholder.rs | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | use anyhow::Result; | ||
| 2 | |||
| 3 | use crate::Cli; | ||
| 4 | |||
| 5 | #[derive(Debug, clap::Args)] | ||
| 6 | pub struct SubCommandArgs {} | ||
| 7 | |||
| 8 | pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | ||
| 9 | Ok(()) | ||
| 10 | } | ||