From 1ec8b9be91ab2d172ad97cd6f402ff23cfca30f9 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 1 Nov 2023 00:00:00 +0000 Subject: feat(helper) add rust workspace add nostr_git_remote_helper with standard helper packages for rust cli --- nostr_git_remote_helper/Cargo.toml | 16 +++++++++++ nostr_git_remote_helper/src/main.rs | 31 ++++++++++++++++++++++ nostr_git_remote_helper/src/sub_commands/mod.rs | 1 + .../src/sub_commands/placeholder.rs | 10 +++++++ 4 files changed, 58 insertions(+) create mode 100644 nostr_git_remote_helper/Cargo.toml create mode 100644 nostr_git_remote_helper/src/main.rs create mode 100644 nostr_git_remote_helper/src/sub_commands/mod.rs create mode 100644 nostr_git_remote_helper/src/sub_commands/placeholder.rs (limited to 'nostr_git_remote_helper') 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 @@ +[package] +name = "nostr-git-remote-helper" +version = "0.0.1" +edition = "2021" +description = "git remote helper for nostr protocol" +authors = ["DanConwayDev "] +readme = "README.md" +license = "MIT" +keywords = ["nostr", "git"] +categories = ["command-line-utilities","git", "git-remote-helper"] + +[dependencies] +anyhow = "1.0.75" +clap = { version = "4.3.19", features = ["derive"] } +futures = "0.3.28" +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 @@ +#![cfg_attr(not(test), warn(clippy::pedantic))] +#![cfg_attr(not(test), warn(clippy::expect_used))] + +use anyhow::Result; +use clap::{Parser, Subcommand}; + +mod sub_commands; + +#[derive(Parser)] +#[command(author, version, about, long_about = None)] +#[command(propagate_version = true)] +pub struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + /// replace with an actual subcommand + Placeholder(sub_commands::placeholder::SubCommandArgs), +} + +#[tokio::main] +async fn main() -> Result<()> { + let cli = Cli::parse(); + match &cli.command { + Commands::Placeholder(args) => { + futures::executor::block_on(sub_commands::placeholder::launch(&cli, args)) + } + } +} 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 @@ +use anyhow::Result; + +use crate::Cli; + +#[derive(Debug, clap::Args)] +pub struct SubCommandArgs {} + +pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { + Ok(()) +} -- cgit v1.2.3