From 117737645058cc8873cd84dde7496c6695ecc762 Mon Sep 17 00:00:00 2001 From: J / Jacob Babich Date: Sat, 5 Oct 2024 02:40:09 -0400 Subject: [PATCH] chore!: put accessing the cli under a subcommand like the README suggests it would be --- multibinary/src/main.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/multibinary/src/main.rs b/multibinary/src/main.rs index 42b9b82..e72e00a 100644 --- a/multibinary/src/main.rs +++ b/multibinary/src/main.rs @@ -1,6 +1,6 @@ use std::{fs::create_dir_all, io::ErrorKind, path::PathBuf}; -use clap::Parser; +use clap::{Parser, Subcommand}; #[derive(Debug, Parser)] struct Args { @@ -10,11 +10,22 @@ struct Args { default_value_os_t = dirs_next::data_local_dir().expect("sorry but you're on a platform where dirs_next::data_local_dir() returned None, so please specify a data directory for the application").join("ac-qu-ai-nt") )] application_data_directory: PathBuf, + + #[command(subcommand)] + command: Command, +} + +#[derive(Debug, Subcommand)] +enum Command { + #[cfg(feature = "cli-clap")] + #[command(alias = "cli")] + CliClap, } fn main() { let Args { application_data_directory, + command, } = Args::parse(); #[cfg(feature = "tracing")] @@ -38,6 +49,8 @@ fn main() { } } - #[cfg(feature = "cli-clap")] - ac_qu_ai_nt_cli_clap::main(); + match command { + #[cfg(feature = "cli-clap")] + Command::CliClap => ac_qu_ai_nt_cli_clap::main(), + } }