1use serde::Serialize;
2use std::path::PathBuf;
3
4use clap::{builder::PossibleValuesParser, Parser, ValueHint};
5
6mod generate_keypair;
7
8#[derive(Parser, Debug, Serialize, Clone)]
10#[command(author, version, about, long_about = None)]
11pub struct CliArgs {
12 #[arg(short, long, value_hint = ValueHint::DirPath)]
14 pub config: Option<PathBuf>,
15
16 #[serde(rename = "log-level")]
18 #[arg(short, long, value_parser = PossibleValuesParser::new(["info", "debug", "info", "warn", "error", "trace"]))]
19 pub log_level: Option<String>,
20
21 #[arg(short, long)]
23 pub port: Option<u16>,
24
25 #[arg(long)]
27 pub host: bool,
28
29 #[arg(short, long, value_parser = PossibleValuesParser::new(["run", "revert"]))]
31 pub migrate: Option<String>,
32
33 #[arg(short, long)]
35 pub generate_keypair: bool,
36
37 #[arg(short, long)]
40 pub watch: bool,
41}
42
43impl CliArgs {
44 pub fn handle_flags(&self) -> Result<(), Box<dyn std::error::Error>> {
46 self.generate_keypair()?;
47 Ok(())
48 }
49}