use std::path::PathBuf;
use clap::{Parser, Subcommand, ValueHint::FilePath};
static LONG_ABT: &str = r#"
fiux: The fastest streaming-first file conveter.
• Supports JSON, NDJSON, TOML, CSV, TSV, PSV and more!
• Formats are detected automatically based on file extension, except for custom
delimter CSV formats (e.g. TSV, PSV, etc.), which are detected with `--input-delimiter <DELIMITER>` and `--output-delimiter <DELIMITER>`.
• if there are any bugs or any features you want, open an issue at: `https://github.com/Tahaa-Dev/fiux`.
╭────────────────·Examples·────────────────╮
│ ••• │
│ fiux convert data.json out.csv │
│ fiux validate broken.ndjson --verbose │
│ fiux convert big.csv big.json --verbose │
│ │
╰──────────────────────────────────────────╯
"#;
#[derive(Parser)]
#[command(
author,
version,
about = "The fastest utility for converting between file formats.",
long_about = LONG_ABT
)]
pub struct FioxArgs {
#[command(subcommand)]
pub cmd: Commands,
#[arg(short, long, value_hint = FilePath, global = true)]
pub(crate) log_file: Option<PathBuf>,
}
#[derive(Subcommand)]
pub enum Commands {
Convert {
#[arg(required = true, value_hint = FilePath)]
input: PathBuf,
#[arg(short, long, required = true, value_hint = FilePath)]
output: PathBuf,
#[arg(short, long)]
append: bool,
#[arg(short, long)]
parse_numbers: bool,
#[arg(long)]
input_delimiter: Option<char>,
#[arg(long)]
output_delimiter: Option<char>,
},
Validate {
#[arg(required = true, value_hint = FilePath)]
input: PathBuf,
#[arg(short, long)]
delimiter: Option<char>,
},
}