use std::fmt::Display;
use clap::{Parser, ValueEnum};
#[derive(Debug, Parser)]
pub struct Cli {
#[arg(long, hide = true)]
pub debug: bool,
#[arg(long)]
pub by_file: bool,
#[arg(short, long, default_value_t = OutputFormat::Tabular)]
pub output_format: OutputFormat,
}
#[derive(Clone, Debug, Default, PartialEq, Eq, ValueEnum)]
#[value(rename_all = "lower")]
pub enum OutputFormat {
#[default]
Tabular,
Json,
Csv,
Yaml,
}
impl Display for OutputFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let s = match self {
Self::Tabular => "tabular",
Self::Yaml => "yaml",
Self::Csv => "csv",
Self::Json => "json",
};
f.write_str(s)
}
}
#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
#[command(name = "cargo", bin_name = "cargo")]
pub enum CargoCli {
#[command(name = "warloc")]
Command(Cli),
}