chore!: put accessing the cli under a subcommand like the README suggests it would be

This commit is contained in:
J / Jacob Babich
2024-10-05 02:40:09 -04:00
parent f37d56edba
commit 1177376450

View File

@@ -1,6 +1,6 @@
use std::{fs::create_dir_all, io::ErrorKind, path::PathBuf}; use std::{fs::create_dir_all, io::ErrorKind, path::PathBuf};
use clap::Parser; use clap::{Parser, Subcommand};
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
struct Args { 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") 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, application_data_directory: PathBuf,
#[command(subcommand)]
command: Command,
}
#[derive(Debug, Subcommand)]
enum Command {
#[cfg(feature = "cli-clap")]
#[command(alias = "cli")]
CliClap,
} }
fn main() { fn main() {
let Args { let Args {
application_data_directory, application_data_directory,
command,
} = Args::parse(); } = Args::parse();
#[cfg(feature = "tracing")] #[cfg(feature = "tracing")]
@@ -38,6 +49,8 @@ fn main() {
} }
} }
#[cfg(feature = "cli-clap")] match command {
ac_qu_ai_nt_cli_clap::main(); #[cfg(feature = "cli-clap")]
Command::CliClap => ac_qu_ai_nt_cli_clap::main(),
}
} }