1 /// this module generate the clap App, which defines
2 /// launch arguments
3
4 /// declare the possible CLI arguments
clap_app() -> clap::App<'static, 'static>5 pub fn clap_app() -> clap::App<'static, 'static> {
6 let app = clap::App::new("broot")
7 .version(env!("CARGO_PKG_VERSION"))
8 .author("dystroy <denys.seguret@gmail.com>")
9 .about(
10 "A tree explorer and a customizable launcher\n\
11 Complete documentation lives at https://dystroy.org/broot"
12 )
13 .setting(clap::AppSettings::ColoredHelp)
14 .arg(clap::Arg::with_name("ROOT").help("sets the root directory"))
15 // tree flags
16 .arg(
17 clap::Arg::with_name("dates")
18 .short("d")
19 .long("dates")
20 .help("Show the last modified date of files and directories"),
21 )
22 .arg(
23 clap::Arg::with_name("no-dates")
24 .short("D")
25 .long("no-dates")
26 .help("Don't show last modified date"),
27 )
28 .arg(
29 clap::Arg::with_name("only-folders")
30 .short("f")
31 .long("only-folders")
32 .help("Only show folders"),
33 )
34 .arg(
35 clap::Arg::with_name("no-only-folders")
36 .short("F")
37 .long("no-only-folders")
38 .help("Show folders and files alike"),
39 )
40 .arg(
41 clap::Arg::with_name("show-root-fs")
42 .long("show-root-fs")
43 .help("Show filesystem info on top"),
44 )
45 .arg(
46 clap::Arg::with_name("show-git-info")
47 .short("g")
48 .long("show-git-info")
49 .help("Show git statuses on files and stats on repo"),
50 )
51 .arg(
52 clap::Arg::with_name("no-show-git-info")
53 .short("G")
54 .long("no-show-git-info")
55 .help("Don't show git statuses on files"),
56 )
57 .arg(
58 clap::Arg::with_name("git-status")
59 .long("git-status")
60 .help("Only show files having an interesting git status, including hidden ones"),
61 )
62 .arg(
63 clap::Arg::with_name("hidden")
64 .short("h")
65 .long("hidden")
66 .help("Show hidden files"),
67 )
68 .arg(
69 clap::Arg::with_name("no-hidden")
70 .short("H")
71 .long("no-hidden")
72 .help("Don't show hidden files"),
73 )
74 .arg(
75 clap::Arg::with_name("show-gitignored")
76 .short("i")
77 .long("show-gitignored")
78 .help("Show files which should be ignored according to git"),
79 )
80 .arg(
81 clap::Arg::with_name("no-show-gitignored")
82 .short("I")
83 .long("no-show-gitignored")
84 .help("Don't show gitignored files"),
85 )
86 .arg(
87 clap::Arg::with_name("permissions")
88 .short("p")
89 .long("permissions")
90 .help("Show permissions, with owner and group"),
91 )
92 .arg(
93 clap::Arg::with_name("no-permissions")
94 .short("P")
95 .long("no-permissions")
96 .help("Don't show permissions"),
97 )
98 .arg(
99 clap::Arg::with_name("sizes")
100 .short("s")
101 .long("sizes")
102 .help("Show the size of files and directories"),
103 )
104 .arg(
105 clap::Arg::with_name("no-sizes")
106 .short("S")
107 .long("no-sizes")
108 .help("Don't show sizes"),
109 )
110 .arg(
111 clap::Arg::with_name("sort-by-count")
112 .long("sort-by-count")
113 .help("Sort by count (only show one level of the tree)"),
114 )
115 .arg(
116 clap::Arg::with_name("sort-by-date")
117 .long("sort-by-date")
118 .help("Sort by date (only show one level of the tree)"),
119 )
120 .arg(
121 clap::Arg::with_name("sort-by-size")
122 .long("sort-by-size")
123 .help("Sort by size (only show one level of the tree)"),
124 )
125 .arg(
126 clap::Arg::with_name("whale-spotting")
127 .short("w")
128 .long("whale-spotting")
129 .help("Sort by size, show ignored and hidden files"),
130 )
131 .arg(
132 clap::Arg::with_name("no-sort")
133 .long("no-sort")
134 .help("Don't sort"),
135 )
136 .arg(
137 clap::Arg::with_name("trim-root")
138 .short("t")
139 .long("trim-root")
140 .help("Trim the root too and don't show a scrollbar"),
141 )
142 .arg(
143 clap::Arg::with_name("no-trim-root")
144 .short("T")
145 .long("no-trim-root")
146 .help("Don't trim the root level, show a scrollbar"),
147 )
148 // other options
149 .arg(
150 clap::Arg::with_name("cmd-export-path")
151 .long("outcmd")
152 .takes_value(true)
153 .help("Where to write the produced cmd (if any)"),
154 )
155 .arg(
156 clap::Arg::with_name("commands")
157 .short("c")
158 .long("cmd")
159 .takes_value(true)
160 .help("Semicolon separated commands to execute"),
161 )
162 .arg(
163 clap::Arg::with_name("color")
164 .long("color")
165 .takes_value(true)
166 .possible_values(&["yes", "no", "auto"])
167 .default_value("auto")
168 .help("Whether to have styles and colors (auto is default and usually OK)"),
169 )
170 .arg(
171 clap::Arg::with_name("conf")
172 .long("conf")
173 .takes_value(true)
174 .help("Semicolon separated paths to specific config files"),
175 )
176 .arg(
177 clap::Arg::with_name("height")
178 .long("height")
179 .help("Height (if you don't want to fill the screen or for file export)")
180 .takes_value(true),
181 )
182 .arg(
183 clap::Arg::with_name("file-export-path") // deprecated since broot 1.6
184 .short("o")
185 .long("out")
186 .takes_value(true)
187 .hidden(true)
188 .help("Where to write the produced path (if any)"),
189 )
190 .arg(
191 clap::Arg::with_name("install")
192 .long("install")
193 .help("Install or reinstall the br shell function"),
194 )
195 .arg(
196 clap::Arg::with_name("set-install-state")
197 .long("set-install-state")
198 .takes_value(true)
199 .value_name("state")
200 .possible_values(&["undefined", "refused", "installed"])
201 .help("Set the installation state (for use in install script)"),
202 )
203 .arg(
204 clap::Arg::with_name("print-shell-function")
205 .long("print-shell-function")
206 .takes_value(true)
207 .value_name("shell")
208 .help("Print to stdout the br function for a given shell"),
209 )
210 .setting(clap::AppSettings::DeriveDisplayOrder);
211 #[cfg(unix)]
212 let app = app
213 .arg(
214 clap::Arg::with_name("listen")
215 .long("listen")
216 .takes_value(true)
217 .help("Listen for commands")
218 )
219 .arg(
220 clap::Arg::with_name("get-root")
221 .long("get-root")
222 .help("Ask for the current root of the remote broot")
223 )
224 .arg(
225 clap::Arg::with_name("send")
226 .long("send")
227 .takes_value(true)
228 .help("send commands to a remote broot then quits")
229 );
230 app
231 }
232