ent_tree/
cli.rs

1use clap::{Parser, ValueEnum};
2
3
4
5#[derive(Parser, Debug, Clone, Default)]
6#[command(
7    name = "ent",
8    version,
9    author,
10    about = "Like tree but better",
11    long_about = None
12)]
13pub struct Cli {
14
15    /// Path to the directory to search. Defaults to the current working directory
16    pub path: Option<String>,
17
18    /// Maximum depth to search
19    #[clap(short, long)]
20    pub depth: Option<usize>,
21
22    /// Show all
23    #[clap(short, long, conflicts_with_all = &["dirs_only", "files_only"])]
24    pub all: bool,
25
26    /// Show only directories
27    #[clap(short = 'D', long = "dirs-only")]
28    pub dirs_only: bool,
29
30    /// Show only files
31    #[clap(short = 'F', long = "files-only")]
32    pub files_only: bool,
33
34    /// Show ignored files
35    #[clap(short, long)]
36    pub ignored: bool,
37
38    /// Show hidden files and directories in tree
39    #[clap(short = 'H', long)]
40    pub hidden: bool,
41
42    /// Export tree as a file
43    #[clap(short, long, value_enum)]
44    pub export: Option<Format>,
45}
46
47#[derive(Parser, Debug, Clone, ValueEnum)]
48pub enum Format {
49    Json,
50}