use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(
name = "geodb",
version,
about = "CLI for querying and inspecting the geodb-core geographic database"
)]
pub struct CliArgs {
#[arg(short = 'i', long = "input", global = true)]
pub input: Option<String>,
#[arg(short = 'f', long = "filter", global = true)]
pub filter: Option<String>,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
Stats,
Countries,
Country {
code: String,
},
States {
iso2: String,
},
Cities {
query: String,
},
Build {
#[arg(short = 'o', long = "output")]
output: Option<String>,
#[arg(long)]
download: bool,
},
Smart {
query: String,
},
Nearest {
#[arg(long)]
lat: f64,
#[arg(long)]
lng: f64,
#[arg(short = 'n', default_value = "5")]
count: usize,
},
Radius {
#[arg(long)]
lat: f64,
#[arg(long)]
lng: f64,
#[arg(short = 'r', long = "radius", default_value = "50.0")]
km: f64,
},
CityBy {
query: String,
},
Query {
#[arg(short = 'c', long)]
city: Option<String>,
#[arg(short = 'r', long)]
region: Option<String>,
#[arg(short = 'C', long)]
country: Option<String>,
#[arg(short = 'n', long, default_value = "20")]
limit: usize,
},
}