1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use std::ffi::OsString;
use clap::Parser;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct TreeArgs {
// ============================ Listing options ============================
#[arg(short = 'a')]
/// All files are listed.
pub show_hidden_files: bool,
#[arg(short = 'd')]
/// List directories only.
pub list_directories_only: bool,
// TODO: -l
#[arg(short = 'f')]
/// Print the full path prefix for each file.
pub print_full_path_prefix: bool,
// TODO: -x
#[arg(short = 'L')]
/// Descend only level directories deep.
pub max_level: Option<usize>,
// TODO: -R
#[arg(short = 'P')]
/// List only those files that match the pattern given.
pub file_include_patterns: Vec<String>,
#[arg(short = 'I')]
/// Do not list files that match the given pattern.
pub file_exclude_patterns: Vec<String>,
#[arg(long = "ignore-case")]
/// Ignore case when pattern matching.
pub ignore_case: bool,
#[arg(long = "matchdirs", requires = "compat")]
/// Include directory names in -P pattern matching.
///
/// Requires the --compat option.
pub match_dirs: bool,
// TODO: --metafirst
// TODO: --prune
// TODO: --info
// TODO: --infofile
#[arg(long = "noreport")]
/// Turn off file/directory count at end of tree listing.
pub no_report: bool,
// TODO: --charset
// TODO: --filelimit
#[arg(short = 'o')]
/// Output to file instead of stdout.
pub output_to_file: Option<OsString>,
// ============================= File options ==============================
// TODO
// ============================ Sorting options ============================
// TODO
// =========================== Graphics options ============================
// TODO
// ========================= XML/HTML/JSON options =========================
// TODO
// ============================= Input options =============================
// TODO
// ============================ Riptree options ============================
#[arg(long)]
/// Enable compatibility mode. Makes riptree2 behave the same as tree.
pub compat: bool,
#[arg(long, conflicts_with = "compat")]
/// Filter rules from .gitignore files are not respected.
///
/// Incompatible with the --compat option.
pub no_gitignore: bool,
#[arg(long, requires = "compat")]
/// Filter rules from .gitignore files are respected (default).
///
/// Requires the --compat option.
pub gitignore: bool,
#[arg(long, requires = "compat")]
/// Show Nerd Fonts icons.
///
/// Requires the --compat option.
pub icons: bool,
#[arg(long, conflicts_with = "compat")]
/// Hide Nerd Fonts icons.
///
/// Incompatible with the --compat option.
pub no_icons: bool,
// ================================= Roots =================================
#[arg()]
pub roots: Vec<String>,
}