mirror of
https://github.com/babichjacob/ac-qu-ai-nt.git
synced 2025-10-02 04:47:53 -04:00
chore!: put accessing the cli under a subcommand like the README suggests it would be
This commit is contained in:
@@ -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(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user