Start server via subcommand

This commit is contained in:
Joscha 2023-08-07 14:49:09 +02:00
parent 9bdfc79c8b
commit 6815c36f5b
3 changed files with 40 additions and 29 deletions

View file

@ -4,16 +4,27 @@ pub const NAME: &str = env!("CARGO_PKG_NAME");
pub const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " (", env!("VERGEN_GIT_SHA"), ")");
#[derive(Debug, clap::Parser)]
#[command(name = NAME, version = VERSION)]
pub struct Args {
pub struct ServerCommand {
/// Path to the repo's tablejohn database.
pub db: PathBuf,
/// Path to the git repo.
pub repo: PathBuf,
}
#[derive(Debug, clap::Parser)]
pub enum Command {
Server(ServerCommand),
}
#[derive(Debug, clap::Parser)]
#[command(name = NAME, version = VERSION)]
pub struct Args {
/// Path to the config file.
#[arg(long, short)]
pub config: Option<PathBuf>,
/// Enable increasingly more verbose output
#[arg(long, short, action = clap::ArgAction::Count)]
pub verbose: u8,
#[command(subcommand)]
pub command: Command,
}