use clap::{crate_name, crate_version, ValueEnum};
use serde_json::json;
#[derive(clap::Args, Debug)]
#[command(next_display_order = None)]
pub(crate) struct Args {
#[arg(short, long, value_enum, default_value_t = Format::Pretty)]
format: Format,
#[arg(long)]
short: bool,
}
#[derive(ValueEnum, Clone, Debug)]
enum Format {
Pretty,
Json,
}
pub(crate) fn run(args: Args) {
if args.short {
println!("{}", crate_version!());
} else {
match args.format {
Format::Pretty => println!("{} {}", crate_name!(), crate_version!()),
Format::Json => println!("{}", json!({ "version": crate_version!() })),
}
}
}