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/src/main.rs | 31 ++++++++++++++++++++++ nostr_git_remote_helper/src/sub_commands/mod.rs | 1 + .../src/sub_commands/placeholder.rs | 10 +++++++ 3 files changed, 42 insertions(+) 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/src') 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