use std::path::PathBuf; use clap::Parser; use clap::ValueEnum; #[derive(Parser, Debug)] #[command( version, about, long_about = "A compression utility for utf-8 encoded text, \ using only basic canonical huffman encoding." )] pub struct Args { /// The input file to be (de)compressed. pub input_file: PathBuf, /// The optional output file for the resulting (de)compressed output. pub output_file: Option, /// Whether to compress or extract. #[arg(short, value_enum)] pub mode: Option, } #[derive(Clone, Copy, Debug, ValueEnum, Default)] pub enum Mode { /// Extract X, #[default] /// Compress C, } impl From for clap::builder::OsStr { fn from(val: Mode) -> Self { match val { Mode::X => clap::builder::OsStr::from("x"), Mode::C => clap::builder::OsStr::from("c"), } } }