use std::path::PathBuf;
use argx::Parser;
#[derive(Debug, argx::ValueEnum)]
enum Format {
Human,
Json,
JsonLines,
}
#[derive(Debug, Parser)]
struct Cli {
input: PathBuf,
#[argx(long, value_enum, default = Format::Human)]
format: Format,
#[argx(long, alias = "colour")]
color: Option<String>,
#[argx(long)]
tag: Vec<String>,
#[argx(long, requires = ["token"])]
endpoint: Option<String>,
#[argx(long)]
token: Option<String>,
#[argx(long, conflicts = ["stdout"])]
destination: Option<PathBuf>,
#[argx(long)]
stdout: bool,
}
fn main() {
let cli = Cli::parse();
eprintln!("input: {}", cli.input.display());
let format = match cli.format {
Format::Human => "human",
Format::Json => "json",
Format::JsonLines => "json-lines",
};
eprintln!("format: {format}");
if let Some(color) = cli.color {
eprintln!("color: {color}");
}
for tag in cli.tag {
eprintln!("tag: {tag}");
}
if let Some(endpoint) = cli.endpoint {
eprintln!("endpoint: {endpoint}");
}
if cli.token.is_some() {
eprintln!("token: provided");
}
if let Some(destination) = cli.destination {
eprintln!("destination: {}", destination.display());
}
eprintln!("stdout: {}", cli.stdout);
}