Skip to content
Myr

app.rs

This file

Path

src/app.rs

574 lines · 23.9 KiB · Rust

Last changed by

improve time option usage (#645)gorogoroumarubefore adoption74c3431

History of this file

Take it

The walk stopped after 200 commits: lines older than 3599a30 point at it.

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 1–3why, one step back
1use clap::{crate_version, App, AppSettings, Arg};
23pub fn build_app() -> App<'static, 'static> {

Small stylistic changesharkdpbefore adoptiona9c7696

line 4why, one step back
4 let mut app = App::new("fd")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 5–9why, one step back
5 .version(crate_version!())
6 .usage("fd [FLAGS/OPTIONS] [<pattern>] [<path>...]")7 .setting(AppSettings::ColoredHelp)8 .setting(AppSettings::DeriveDisplayOrder)9 .after_help(

Inline the help textssharkdpbefore adoptione2a7d34

lines 10–11why, one step back
10 "Note: `fd -h` prints a short and concise overview while `fd --help` gives all \
11 details.",

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 12–13why, one step back
12 )
13 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 14why, one step back
14 Arg::with_name("hidden")

Fix idempotent flagsDeepansh Soodbefore adoption2664998

lines 15–16why, one step back
15 .long("hidden")
16 .short("H")

Inline the help textssharkdpbefore adoptione2a7d34

lines 17–23why, one step back
17 .overrides_with("hidden")
18 .help("Search hidden files and directories")19 .long_help(20 "Include hidden directories and files in the search results (default: \21 hidden files and directories are skipped). Files and directories are \22 considered to be hidden if their name starts with a `.` sign (dot).",23 ),

Fix idempotent flagsDeepansh Soodbefore adoption2664998

lines 24–25why, one step back
24 )
25 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 26why, one step back
26 Arg::with_name("no-ignore")

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 27–28why, one step back
27 .long("no-ignore")
28 .short("I")

Inline the help textssharkdpbefore adoptione2a7d34

lines 29–32why, one step back
29 .overrides_with("no-ignore")
30 .help("Do not respect .(git|fd)ignore files")31 .long_help(32 "Show search results from files and directories that would otherwise be \

Add global fdignore supportBobbie Soedirgobefore adoption79d5a5b

line 33why, one step back
33 ignored by '.gitignore', '.ignore', '.fdignore', or the global ignore file.",

Inline the help textssharkdpbefore adoptione2a7d34

line 34why, one step back
34 ),

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 35–36why, one step back
35 )
36 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 37why, one step back
37 Arg::with_name("no-ignore-vcs")

Fix CI errorDeepanshbefore adoptiona6ed0fc

line 38why, one step back
38 .long("no-ignore-vcs")

Inline the help textssharkdpbefore adoptione2a7d34

line 39why, one step back
39 .overrides_with("no-ignore-vcs")

Remove two options from short -h help textsharkdpbefore adoption1a96544

line 40why, one step back
40 .hidden_short_help(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 41–44why, one step back
41 .long_help(
42 "Show search results from files and directories that would otherwise be \43 ignored by '.gitignore' files.",44 ),

Add global fdignore supportBobbie Soedirgobefore adoption79d5a5b

lines 45–50why, one step back
45 )
46 .arg(47 Arg::with_name("no-global-ignore-file")48 .long("no-global-ignore-file")49 .hidden(true)50 .long_help("Do not respect the global ignore file."),

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 51–52why, one step back
51 )
52 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 53why, one step back
53 Arg::with_name("rg-alias-hidden-ignore")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 54why, one step back
54 .short("u")

Expand help for `-u`, add to manpageNathan Henriebefore adoption59c27ba

line 55why, one step back
55 .long("unrestricted")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 56why, one step back
56 .multiple(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 57–61why, one step back
57 .hidden_short_help(true)
58 .long_help(59 "Alias for '--no-ignore'. Can be repeated. '-uu' is an alias for \60 '--no-ignore --hidden'.",61 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 62–63why, one step back
62 )
63 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 64why, one step back
64 Arg::with_name("case-sensitive")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 65–66why, one step back
65 .long("case-sensitive")
66 .short("s")

Inline the help textssharkdpbefore adoptione2a7d34

lines 67–73why, one step back
67 .overrides_with_all(&["ignore-case", "case-sensitive"])
68 .help("Case-sensitive search (default: smart case)")69 .long_help(70 "Perform a case-sensitive search. By default, fd uses case-insensitive \71 searches, unless the pattern contains an uppercase character (smart \72 case).",73 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 74–75why, one step back
74 )
75 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 76why, one step back
76 Arg::with_name("ignore-case")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 77–78why, one step back
77 .long("ignore-case")
78 .short("i")

Inline the help textssharkdpbefore adoptione2a7d34

lines 79–85why, one step back
79 .overrides_with_all(&["case-sensitive", "ignore-case"])
80 .help("Case-insensitive search (default: smart case)")81 .long_help(82 "Perform a case-insensitive search. By default, fd uses case-insensitive \83 searches, unless the pattern contains an uppercase character (smart \84 case).",85 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 86–87why, one step back
86 )
87 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 88why, one step back
88 Arg::with_name("glob")

Implement glob-based searchessharkdpbefore adoptiond5da615

lines 89–90why, one step back
89 .long("glob")
90 .short("g")

Fix idempotent flagsDeepansh Soodbefore adoption2664998

line 91why, one step back
91 .conflicts_with("fixed-strings")

Inline the help textssharkdpbefore adoptione2a7d34

lines 92–94why, one step back
92 .overrides_with("glob")
93 .help("Glob-based search (default: regular expression)")94 .long_help("Perform a glob-based search instead of a regular expression search."),

Implement glob-based searchessharkdpbefore adoptiond5da615

lines 95–96why, one step back
95 )
96 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 97why, one step back
97 Arg::with_name("regex")

Add --regex option to override --globsharkdpbefore adoptioneac20a8

line 98why, one step back
98 .long("regex")

Fix idempotent flagsDeepansh Soodbefore adoption2664998

line 99why, one step back
99 .overrides_with_all(&["glob", "regex"])

Inline the help textssharkdpbefore adoptione2a7d34

lines 100–104why, one step back
100 .hidden_short_help(true)
101 .long_help(102 "Perform a regular-expression based search (default). This can be used to \103 override --glob.",104 ),

Add --regex option to override --globsharkdpbefore adoptioneac20a8

lines 105–106why, one step back
105 )
106 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 107why, one step back
107 Arg::with_name("fixed-strings")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 108–109why, one step back
108 .long("fixed-strings")
109 .short("F")

Fix idempotent flagsDeepansh Soodbefore adoption2664998

line 110why, one step back
110 .alias("literal")

Inline the help textssharkdpbefore adoptione2a7d34

line 111why, one step back
111 .overrides_with("fixed-strings")

Remove two options from short -h help textsharkdpbefore adoption1a96544

line 112why, one step back
112 .hidden_short_help(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 113–115why, one step back
113 .long_help(
114 "Treat the pattern as a literal string instead of a regular expression.",115 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 116why, one step back
116 )

Fix CI errorDeepanshbefore adoptiona6ed0fc

line 117why, one step back
117 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 118why, one step back
118 Arg::with_name("absolute-path")

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 119–120why, one step back
119 .long("absolute-path")
120 .short("a")

Inline the help textssharkdpbefore adoptione2a7d34

lines 121–125why, one step back
121 .overrides_with("absolute-path")
122 .help("Show absolute instead of relative paths")123 .long_help(124 "Shows the full path starting from the root as opposed to relative paths.",125 ),

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 126–127why, one step back
126 )
127 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 128why, one step back
128 Arg::with_name("list-details")

Rename --list to --list-detailssharkdpbefore adoptionc9dc617

line 129why, one step back
129 .long("list-details")

Add `-l`/`--list` optionsharkdpbefore adoptionda5cd12

line 130why, one step back
130 .short("l")

Inline the help textssharkdpbefore adoptione2a7d34

line 131why, one step back
131 .conflicts_with("absolute-path")

Adapt --list-details help messagesharkdpbefore adoption2cfb1a2

line 132why, one step back
132 .help("Use a long listing format with file metadata")

Inline the help textssharkdpbefore adoptione2a7d34

lines 133–138why, one step back
133 .long_help(
134 "Use a detailed listing format like 'ls -l'. This is basically an alias \135 for '--exec-batch ls -l' with some additional 'ls' options. This can be \136 used to see more metadata, to show symlink targets and to achieve a \137 deterministic sort order.",138 ),

Add `-l`/`--list` optionsharkdpbefore adoptionda5cd12

lines 139–140why, one step back
139 )
140 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 141why, one step back
141 Arg::with_name("follow")

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 142–144why, one step back
142 .long("follow")
143 .short("L")144 .alias("dereference")

Inline the help textssharkdpbefore adoptione2a7d34

lines 145–150why, one step back
145 .overrides_with("follow")
146 .help("Follow symbolic links")147 .long_help(148 "By default, fd does not descend into symlinked directories. Using this \149 flag, symbolic links are also traversed.",150 ),

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 151–152why, one step back
151 )
152 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 153why, one step back
153 Arg::with_name("full-path")

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 154–155why, one step back
154 .long("full-path")
155 .short("p")

Inline the help textssharkdpbefore adoptione2a7d34

lines 156–162why, one step back
156 .overrides_with("full-path")
157 .help("Search full path (default: file-/dirname only)")158 .long_help(159 "By default, the search pattern is only matched against the filename (or \160 directory name). Using this flag, the pattern is matched against the \161 full path.",162 ),

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 163–164why, one step back
163 )
164 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 165why, one step back
165 Arg::with_name("null_separator")

Fix CI errorDeepanshbefore adoptiona6ed0fc

lines 166–167why, one step back
166 .long("print0")
167 .short("0")

Add `-l`/`--list` optionsharkdpbefore adoptionda5cd12

line 168why, one step back
168 .overrides_with("print0")

Inline the help textssharkdpbefore adoptione2a7d34

lines 169–174why, one step back
169 .conflicts_with("list-details")
170 .help("Separate results by the null character")171 .long_help(172 "Separate search results by the null character (instead of newlines). \173 Useful for piping results to 'xargs'.",174 ),

Fix CI errorDeepanshbefore adoptiona6ed0fc

line 175why, one step back
175 )

Inline the help textssharkdpbefore adoptione2a7d34

line 176why, one step back
176 .arg(

Add --min-depth and --exact-depthsharkdpbefore adoptiond63c63b

line 177why, one step back
177 Arg::with_name("max-depth")

Inline the help textssharkdpbefore adoptione2a7d34

lines 178–180why, one step back
178 .long("max-depth")
179 .short("d")180 .takes_value(true)

Add --min-depth and --exact-depthsharkdpbefore adoptiond63c63b

line 181why, one step back
181 .value_name("depth")

Inline the help textssharkdpbefore adoptione2a7d34

lines 182–187why, one step back
182 .help("Set maximum search depth (default: none)")
183 .long_help(184 "Limit the directory traversal to a given depth. By default, there is no \185 limit on the search depth.",186 ),187 )

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 188–189why, one step back
188 // support --maxdepth as well, for compatibility with rg
189 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 190why, one step back
190 Arg::with_name("rg-depth")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 191–192why, one step back
191 .long("maxdepth")
192 .hidden(true)

Inline the help textssharkdpbefore adoptione2a7d34

line 193why, one step back
193 .takes_value(true)

Add --min-depth and --exact-depthsharkdpbefore adoptiond63c63b

lines 194–216why, one step back
194 )
195 .arg(196 Arg::with_name("min-depth")197 .long("min-depth")198 .takes_value(true)199 .value_name("depth")200 .hidden_short_help(true)201 .long_help(202 "Only show search results starting at the given depth. \203 See also: '--max-depth' and '--exact-depth'",204 ),205 )206 .arg(207 Arg::with_name("exact-depth")208 .long("exact-depth")209 .takes_value(true)210 .value_name("depth")211 .hidden_short_help(true)212 .conflicts_with_all(&["max-depth", "min-depth"])213 .long_help(214 "Only show search results at the exact given depth. This is an alias for \215 '--min-depth <depth> --max-depth <depth>'.",216 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 217–218why, one step back
217 )
218 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 219why, one step back
219 Arg::with_name("file-type")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 220–236why, one step back
220 .long("type")
221 .short("t")222 .multiple(true)223 .number_of_values(1)224 .takes_value(true)225 .value_name("filetype")226 .possible_values(&[227 "f",228 "file",229 "d",230 "directory",231 "l",232 "symlink",233 "x",234 "executable",235 "e",236 "empty",

Add new `--type socket` and `--type pipe` filterssharkdpbefore adoptioncb56add

lines 237–240why, one step back
237 "s",
238 "socket",239 "p",240 "pipe",

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 241why, one step back
241 ])

Inline the help textssharkdpbefore adoptione2a7d34

lines 242–244why, one step back
242 .hide_possible_values(true)
243 .help(244 "Filter by type: file (f), directory (d), symlink (l),\nexecutable (x), \

Add new `--type socket` and `--type pipe` filterssharkdpbefore adoptioncb56add

line 245why, one step back
245 empty (e), socket (s), pipe (p)",

Inline the help textssharkdpbefore adoptione2a7d34

lines 246–252why, one step back
246 )
247 .long_help(248 "Filter the search by type (multiple allowable filetypes can be specified):\n \249 'f' or 'file': regular files\n \250 'd' or 'directory': directories\n \251 'l' or 'symlink': symbolic links\n \252 'x' or 'executable': executables\n \

Add new `--type socket` and `--type pipe` filterssharkdpbefore adoptioncb56add

lines 253–255why, one step back
253 'e' or 'empty': empty files or directories\n \
254 's' or 'socket': socket\n \255 'p' or 'pipe': named pipe (FIFO)",

Inline the help textssharkdpbefore adoptione2a7d34

line 256why, one step back
256 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 257–258why, one step back
257 )
258 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 259why, one step back
259 Arg::with_name("extension")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 260–264why, one step back
260 .long("extension")
261 .short("e")262 .multiple(true)263 .number_of_values(1)264 .takes_value(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 265–270why, one step back
265 .value_name("ext")
266 .help("Filter by file extension")267 .long_help(268 "(Additionally) filter search results by their file extension. Multiple \269 allowable file extensions can be specified.",270 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 271–272why, one step back
271 )
272 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 273why, one step back
273 Arg::with_name("exec")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 274–278why, one step back
274 .long("exec")
275 .short("x")276 .min_values(1)277 .allow_hyphen_values(true)278 .value_terminator(";")

Add `-l`/`--list` optionsharkdpbefore adoptionda5cd12

line 279why, one step back
279 .value_name("cmd")

Inline the help textssharkdpbefore adoptione2a7d34

lines 280–293why, one step back
280 .conflicts_with("list-details")
281 .help("Execute a command for each search result")282 .long_help(283 "Execute a command for each search result.\n\284 All arguments following --exec are taken to be arguments to the command until the \285 argument ';' is encountered.\n\286 Each occurrence of the following placeholders is substituted by a path derived from the \287 current search result before the command is executed:\n \288 '{}': path\n \289 '{/}': basename\n \290 '{//}': parent directory\n \291 '{.}': path without file extension\n \292 '{/.}': basename without file extension",293 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 294–295why, one step back
294 )
295 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 296why, one step back
296 Arg::with_name("exec-batch")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 297–302why, one step back
297 .long("exec-batch")
298 .short("X")299 .min_values(1)300 .allow_hyphen_values(true)301 .value_terminator(";")302 .value_name("cmd")

Inline the help textssharkdpbefore adoptione2a7d34

lines 303–316why, one step back
303 .conflicts_with_all(&["exec", "list-details"])
304 .help("Execute a command with all search results at once")305 .long_help(306 "Execute a command with all search results at once.\n\307 All arguments following --exec-batch are taken to be arguments to the command until the \308 argument ';' is encountered.\n\309 A single occurrence of the following placeholders is authorized and substituted by the paths derived from the \310 search results before the command is executed:\n \311 '{}': path\n \312 '{/}': basename\n \313 '{//}': parent directory\n \314 '{.}': path without file extension\n \315 '{/.}': basename without file extension",316 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 317–318why, one step back
317 )
318 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 319why, one step back
319 Arg::with_name("exclude")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 320–324why, one step back
320 .long("exclude")
321 .short("E")322 .takes_value(true)323 .value_name("pattern")324 .number_of_values(1)

Inline the help textssharkdpbefore adoptione2a7d34

lines 325–331why, one step back
325 .multiple(true)
326 .help("Exclude entries that match the given glob pattern")327 .long_help(328 "Exclude files/directories that match the given glob pattern. This \329 overrides any other ignore logic. Multiple exclude patterns can be \330 specified.",331 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 332–333why, one step back
332 )
333 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 334why, one step back
334 Arg::with_name("ignore-file")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 335–339why, one step back
335 .long("ignore-file")
336 .takes_value(true)337 .value_name("path")338 .number_of_values(1)339 .multiple(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 340–344why, one step back
340 .hidden_short_help(true)
341 .long_help(342 "Add a custom ignore-file in '.gitignore' format. These files have a low \343 precedence.",344 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 345–346why, one step back
345 )
346 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 347why, one step back
347 Arg::with_name("color")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 348–352why, one step back
348 .long("color")
349 .short("c")350 .takes_value(true)351 .value_name("when")352 .possible_values(&["never", "auto", "always"])

Inline the help textssharkdpbefore adoptione2a7d34

lines 353–360why, one step back
353 .hide_possible_values(true)
354 .help("When to use colors: never, *auto*, always")355 .long_help(356 "Declare when to use color for the pattern match output:\n \357 'auto': show colors if the output goes to an interactive console (default)\n \358 'never': do not use colorized output\n \359 'always': always use colorized output",360 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 361–362why, one step back
361 )
362 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 363why, one step back
363 Arg::with_name("threads")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 364–367why, one step back
364 .long("threads")
365 .short("j")366 .takes_value(true)367 .value_name("num")

Inline the help textssharkdpbefore adoptione2a7d34

lines 368–372why, one step back
368 .hidden_short_help(true)
369 .long_help(370 "Set number of threads to use for searching & executing (default: number \371 of available CPU cores)",372 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 373–374why, one step back
373 )
374 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 375why, one step back
375 Arg::with_name("size")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 376–380why, one step back
376 .long("size")
377 .short("S")378 .takes_value(true)379 .number_of_values(1)380 .allow_hyphen_values(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 381–388why, one step back
381 .multiple(true)
382 .help("Limit results based on the size of files.")383 .long_help(384 "Limit results based on the size of files using the format <+-><NUM><UNIT>.\n \385 '+': file size must be greater than or equal to this\n \386 '-': file size must be less than or equal to this\n \387 'NUM': The numeric size (e.g. 500)\n \388 'UNIT': The units for NUM. They are not case-sensitive.\n\

Update --size documentationsharkdpbefore adoptione3c77ef

lines 389–397why, one step back
389 Allowed unit values:\n \
390 'b': bytes\n \391 'k': kilobytes (base ten, 10^3 = 1000 bytes)\n \392 'm': megabytes\n \393 'g': gigabytes\n \394 't': terabytes\n \395 'ki': kibibytes (base two, 2^10 = 1024 bytes)\n \396 'mi': mebibytes\n \397 'gi': gibibytes\n \

Inline the help textssharkdpbefore adoptione2a7d34

lines 398–399why, one step back
398 'ti': tebibytes",
399 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 400–401why, one step back
400 )
401 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 402why, one step back
402 Arg::with_name("max-buffer-time")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 403–404why, one step back
403 .long("max-buffer-time")
404 .takes_value(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 405–409why, one step back
405 .hidden(true)
406 .long_help(407 "Amount of time in milliseconds to buffer, before streaming the search \408 results to the console.",409 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 410–411why, one step back
410 )
411 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 412why, one step back
412 Arg::with_name("changed-within")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 413–414why, one step back
413 .long("changed-within")
414 .alias("change-newer-than")

improve time option usage (#645)gorogoroumarubefore adoption74c3431

line 415why, one step back
415 .alias("newer")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 416–417why, one step back
416 .takes_value(true)
417 .value_name("date|dur")

Inline the help textssharkdpbefore adoptione2a7d34

lines 418–427why, one step back
418 .number_of_values(1)
419 .help("Filter by file modification time (newer than)")420 .long_help(421 "Filter results based on the file modification time. The argument can be provided \422 as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \423 '--change-newer-than' can be used as an alias.\n\424 Examples:\n \425 --changed-within 2weeks\n \426 --change-newer-than '2018-10-27 10:00:00'",427 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 428–429why, one step back
428 )
429 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 430why, one step back
430 Arg::with_name("changed-before")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 431–432why, one step back
431 .long("changed-before")
432 .alias("change-older-than")

improve time option usage (#645)gorogoroumarubefore adoption74c3431

line 433why, one step back
433 .alias("older")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 434–435why, one step back
434 .takes_value(true)
435 .value_name("date|dur")

Inline the help textssharkdpbefore adoptione2a7d34

lines 436–445why, one step back
436 .number_of_values(1)
437 .help("Filter by file modification time (older than)")438 .long_help(439 "Filter results based on the file modification time. The argument can be provided \440 as a specific point in time (YYYY-MM-DD HH:MM:SS) or as a duration (10h, 1d, 35min). \441 '--change-older-than' can be used as an alias.\n\442 Examples:\n \443 --changed-before '2018-10-27 10:00:00'\n \444 --change-older-than 2weeks",445 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 446–447why, one step back
446 )
447 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 448why, one step back
448 Arg::with_name("max-results")

Add --max-results=<count> optionsharkdpbefore adoptiond43827f

lines 449–451why, one step back
449 .long("max-results")
450 .takes_value(true)451 .value_name("count")

Do not allow list-details in combination with -1sharkdpbefore adoption0335cc3

lines 452–457why, one step back
452 // We currently do not support --max-results in combination with
453 // program execution because the results that come up in a --max-results454 // search are non-deterministic. Users might think that they can run the455 // same search with `--exec rm` attached and get a reliable removal of456 // the files they saw in the previous search.457 .conflicts_with_all(&["exec", "exec-batch", "list-details"])

Inline the help textssharkdpbefore adoptione2a7d34

lines 458–459why, one step back
458 .hidden_short_help(true)
459 .long_help("Limit the number of search results to 'count' and quit immediately."),

Add --max-results=<count> optionsharkdpbefore adoptiond43827f

lines 460–461why, one step back
460 )
461 .arg(

Add alias -1 for --max-results=1Danny Möschbefore adoption2bab4a2

lines 462–465why, one step back
462 Arg::with_name("max-one-result")
463 .short("1")464 .hidden_short_help(true)465 .overrides_with("max-results")

Do not allow list-details in combination with -1sharkdpbefore adoption0335cc3

line 466why, one step back
466 .conflicts_with_all(&["exec", "exec-batch", "list-details"])

Add alias -1 for --max-results=1Danny Möschbefore adoption2bab4a2

lines 467–470why, one step back
467 .long_help("Limit the search to a single result and quit immediately. \
468 This is an alias for '--max-results=1'.")469 )470 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 471why, one step back
471 Arg::with_name("show-errors")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 472why, one step back
472 .long("show-errors")

Fix idempotent flagsDeepansh Soodbefore adoption2664998

line 473why, one step back
473 .hidden_short_help(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 474–478why, one step back
474 .overrides_with("show-errors")
475 .long_help(476 "Enable the display of filesystem errors for situations such as \477 insufficient permissions or dead symlinks.",478 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 479why, one step back
479 )

Allow changing current working directory of fdRafał Hajdackibefore adoptionfb205f5

line 480why, one step back
480 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 481why, one step back
481 Arg::with_name("base-directory")

Allow changing current working directory of fdRafał Hajdackibefore adoptionfb205f5

lines 482–485why, one step back
482 .long("base-directory")
483 .takes_value(true)484 .value_name("path")485 .number_of_values(1)

Inline the help textssharkdpbefore adoptione2a7d34

lines 486–493why, one step back
486 .hidden_short_help(true)
487 .long_help(488 "Change the current working directory of fd to the provided path. The \489 means that search results will be shown with respect to the given base \490 path. Note that relative paths which are passed to fd via the positional \491 <path> argument or the '--search-path' option will also be resolved \492 relative to this directory.",493 ),

Allow changing current working directory of fdRafał Hajdackibefore adoptionfb205f5

line 494why, one step back
494 )

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 495why, one step back
495 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

lines 496–501why, one step back
496 Arg::with_name("pattern").help(
497 "the search pattern - a regular expression unless '--glob' is used (optional)",498 ),499 )500 .arg(501 Arg::with_name("path-separator")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 502–504why, one step back
502 .takes_value(true)
503 .value_name("separator")504 .long("path-separator")

Inline the help textssharkdpbefore adoptione2a7d34

lines 505–509why, one step back
505 .hidden_short_help(true)
506 .long_help(507 "Set the path separator to use when printing file paths. The default is \508 the OS-specific separator ('/' on Unix, '\\' on Windows).",509 ),

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 510–511why, one step back
510 )
511 .arg(

Inline the help textssharkdpbefore adoptione2a7d34

lines 512–521why, one step back
512 Arg::with_name("path")
513 .multiple(true)514 .help("the root directory for the filesystem search (optional)")515 .long_help(516 "The directory where the filesystem search is rooted (optional). If \517 omitted, search the current working directory.",518 ),519 )520 .arg(521 Arg::with_name("search-path")

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

lines 522–526why, one step back
522 .long("search-path")
523 .takes_value(true)524 .conflicts_with("path")525 .multiple(true)526 .hidden_short_help(true)

Inline the help textssharkdpbefore adoptione2a7d34

lines 527–532why, one step back
527 .number_of_values(1)
528 .long_help(529 "Provide paths to search as an alternative to the positional <path> \530 argument. Changes the usage to `fd [FLAGS/OPTIONS] --search-path <path> \531 --search-path <path2> [<pattern>]`",532 ),

Restrict `--one-file-system` to supported systemsSimon Engmannbefore adoptiondea1fbe

lines 533–534why, one step back
533 );
534

[ownership] add --owner arg parsing and storageAlexandru Macoveibefore adoption4f9a024

lines 535–539why, one step back
535 if cfg!(unix) {
536 app = app.arg(537 Arg::with_name("owner")538 .long("owner")539 .short("o")

[ownership] add help text for --ownerAlexandru Macoveibefore adoption6a68ac8

lines 540–551why, one step back
540 .takes_value(true)
541 .value_name("user:group")542 .help("Filter by owning user and/or group")543 .long_help(544 "Filter files by their user and/or group. \545 Format: [(user|uid)][:(group|gid)]. Either side is optional. \546 Precede either side with a '!' to exclude files instead.\n\547 Examples:\n \548 --owner john\n \549 --owner :students\n \550 --owner '!john:students'",551 ),

[ownership] add --owner arg parsing and storageAlexandru Macoveibefore adoption4f9a024

lines 552–554why, one step back
552 );
553 }554

Restrict `--one-file-system` to supported systemsSimon Engmannbefore adoptiondea1fbe

lines 555–556why, one step back
555 // Make `--one-file-system` available only on Unix and Windows platforms, as per the
556 // restrictions on the corresponding option in the `ignore` crate.

Add aliases for `--one-file-system`Simon Engmannbefore adoption6f7d108

line 557why, one step back
557 // Provide aliases `mount` and `xdev` for people coming from `find`.

Shorten `cfg!()` checksSimon Engmannbefore adoptioned6c184

line 558why, one step back
558 if cfg!(any(unix, windows)) {

Small stylistic changesharkdpbefore adoptiona9c7696

line 559why, one step back
559 app = app.arg(

Inline the help textssharkdpbefore adoptione2a7d34

line 560why, one step back
560 Arg::with_name("one-file-system")

Add aliases for `--one-file-system`Simon Engmannbefore adoption6f7d108

line 561why, one step back
561 .long("one-file-system")

Hide --one-file-system from the short help textsharkdpbefore adoptionc001dd4

line 562why, one step back
562 .aliases(&["mount", "xdev"])

Inline the help textssharkdpbefore adoptione2a7d34

lines 563–569why, one step back
563 .hidden_short_help(true)
564 .long_help(565 "By default, fd will traverse the file system tree as far as other options \566 dictate. With this flag, fd ensures that it does not descend into a \567 different file system than the one it started in. Comparable to the -mount \568 or -xdev filters of find(1).",569 ),

Small stylistic changesharkdpbefore adoptiona9c7696

line 570why, one step back
570 );

Restrict `--one-file-system` to supported systemsSimon Engmannbefore adoptiondea1fbe

line 571why, one step back
571 }

Small stylistic changesharkdpbefore adoptiona9c7696

lines 572–573why, one step back
572
573 app

Support FILE_ATTRIBUTE_HIDDEN on Windows (#478)David Peterbefore adoption3599a30

line 574why, one step back
574}