Skip to main content

anon_flatten/
cli.rs

1use clap::Parser;
2use std::path::PathBuf;
3
4#[derive(Parser, Debug)]
5#[command(
6    name = "anon-flatten",
7    about = "一个简单的文件目录扁平化工具,让复杂的嵌套文件夹结构变得和爱音一样平 | A simple file directory flattening tool",
8    version,
9    after_help = "\x1b[38;2;255;136;153m🎸 让你的文件夹像千早爱音一样,简单直接,一马平川!\x1b[0m"
10)]
11pub struct Args {
12    /// 源文件夹路径 | Source directory path
13    #[arg(short = 'i', long = "input")]
14    pub input: PathBuf,
15
16    /// 目标文件夹路径 | Target directory path
17    #[arg(short = 'o', long = "output")]
18    pub output: PathBuf,
19
20    /// 预览模式 | Preview mode
21    #[arg(short = 'p', long = "preview")]
22    pub preview: bool,
23
24    /// 剪切模式 | Cut mode
25    #[arg(short = 'x', long = "cut")]
26    pub cut: bool,
27
28    /// 排除的文件扩展名(逗号分隔或多次指定)| Exclude file extensions (comma-separated or multiple times)
29    ///
30    /// Example: -e txt,log,tmp  or  -e txt -e log -e tmp
31    #[arg(
32        short = 'e',
33        long = "exclude",
34        value_name = "EXT",
35        value_delimiter = ','
36    )]
37    pub exclude: Vec<String>,
38}
39
40impl Args {
41    pub fn parse_args() -> Self {
42        Self::parse()
43    }
44}