use clap::{Parser, ValueEnum};
use std::path::PathBuf;
#[derive(Parser)]
#[command(
about,
author,
version,
after_help = "OUTPUT pattern accepts placeholders that have the format of '{G:P}' where 'G' \
is the captured group and 'P' is the padding of digits with `0`. Please refer to \
https://github.com/yaa110/nomino for more information.",
next_display_order = None,
)]
pub struct Cli {
#[arg(short, long, visible_alias = "dry-run")]
pub test: bool,
#[arg(short = 'k', long)]
pub mkdir: bool,
#[arg(short = 'w', long)]
pub overwrite: bool,
#[arg(short = 'E', long = "no-extension")]
pub no_extension: bool,
#[arg(short, long = "dir", value_name = "PATH")]
pub directory: Option<PathBuf>,
#[arg(long, value_name = "DEPTH")]
pub max_depth: Option<usize>,
#[arg(long)]
pub depth: Option<usize>,
#[arg(short, long, value_name = "PATH")]
pub generate: Option<PathBuf>,
#[arg(short, long)]
pub quiet: bool,
#[arg(short, long, value_name = "PATH", visible_alias = "from-file")]
pub map: Option<PathBuf>,
#[arg(short, long, value_name = "ORDER", ignore_case = true)]
pub sort: Option<Order>,
#[arg(short, long, value_name = "PATTERN", requires = "output")]
pub regex: Option<String>,
#[arg(value_name = "[SOURCE] OUTPUT")]
pub output: Vec<String>,
}
impl Cli {
pub fn parse() -> Self {
<Self as Parser>::parse()
}
}
#[derive(Clone, ValueEnum)]
pub enum Order {
Asc,
Desc,
}
#[cfg(test)]
mod tests {
#[test]
fn verify_cli() {
use clap::CommandFactory;
super::Cli::command().debug_assert();
}
}