use clap::{Args, Parser, Subcommand};
use std::{net::IpAddr, path::PathBuf};
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub struct CommandLineArguments {
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
#[command(arg_required_else_help = true)]
Ip2location(Ip2LocationArguments),
#[command(arg_required_else_help = true)]
Ipgeolocation(IpGeolocationArguments),
#[command(arg_required_else_help = true)]
Config(ConfigArguments),
#[command(subcommand)]
Completions(ShellCompletions),
}
#[derive(Debug, Args)]
pub struct Ip2LocationArguments {
pub addr: IpAddr,
}
#[derive(Debug, Args)]
pub struct IpGeolocationArguments {
pub addr: IpAddr,
}
#[derive(Debug, Args)]
pub struct ConfigArguments {
#[arg(short, long)]
pub show: bool,
#[arg(short, long)]
pub edit: bool,
#[arg(long)]
pub print_path: bool,
}
#[derive(Debug, Subcommand)]
pub enum ShellCompletions {
Bash(OutDir),
Zsh(OutDir),
Fish(OutDir),
PowerShell(OutDir),
Elvish(OutDir),
}
#[derive(Debug, Args)]
pub struct OutDir {
pub path: Option<PathBuf>,
}