app.rs
This file
Path
src/app.rs
110 lines · 3.7 KiB · Rust
Last changed by
Update help textsharkdpbefore adoption0aae4a3
History of this fileTake it
Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 1–4why, one step back1use clap::{App, AppSettings, Arg};23pub fn build_app() -> App<'static, 'static> {4 App::new("fd")Code style udpatessharkdpbefore adoption34e4620
lines 5–10why, one step back5 .version(crate_version!())6 .usage("fd [FLAGS/OPTIONS] [<pattern>] [<path>]")7 .setting(AppSettings::ColoredHelp)8 .setting(AppSettings::DeriveDisplayOrder)9 .arg(10 Arg::with_name("hidden")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 11–12why, one step back11 .long("hidden")12 .short("H")Code style udpatessharkdpbefore adoption34e4620
lines 13–16why, one step back13 .help("Search hidden files and directories"),14 )15 .arg(16 Arg::with_name("no-ignore")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 17–18why, one step back17 .long("no-ignore")18 .short("I")Code style udpatessharkdpbefore adoption34e4620
lines 19–22why, one step back19 .help("Do not respect .(git)ignore files"),20 )21 .arg(22 Arg::with_name("case-sensitive")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 23–24why, one step back23 .long("case-sensitive")24 .short("s")Code style udpatessharkdpbefore adoption34e4620
lines 25–28why, one step back25 .help("Case-sensitive search (default: smart case)"),26 )27 .arg(28 Arg::with_name("absolute-path")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 29–30why, one step back29 .long("absolute-path")30 .short("a")Code style udpatessharkdpbefore adoption34e4620
lines 31–34why, one step back31 .help("Show absolute instead of relative paths"),32 )33 .arg(34 Arg::with_name("follow")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 35–37why, one step back35 .long("follow")36 .short("L")37 .alias("dereference")Code style udpatessharkdpbefore adoption34e4620
lines 38–41why, one step back38 .help("Follow symbolic links"),39 )40 .arg(41 Arg::with_name("full-path")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 42–43why, one step back42 .long("full-path")43 .short("p")Code style udpatessharkdpbefore adoption34e4620
lines 44–47why, one step back44 .help("Search full path (default: file-/dirname only)"),45 )46 .arg(47 Arg::with_name("null_separator")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 48–49why, one step back48 .long("print0")49 .short("0")Code style udpatessharkdpbefore adoption34e4620
lines 50–53why, one step back50 .help("Separate results by the null character"),51 )52 .arg(53 Arg::with_name("depth")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 54–56why, one step back54 .long("max-depth")55 .short("d")56 .takes_value(true)Code style udpatessharkdpbefore adoption34e4620
lines 57–60why, one step back57 .help("Set maximum search depth (default: none)"),58 )59 .arg(60 Arg::with_name("file-type")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 61–63why, one step back61 .long("type")62 .short("t")63 .takes_value(true)Update help textsharkdpbefore adoption0aae4a3
line 64why, one step back64 .value_name("filetype")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 65–66why, one step back65 .possible_values(&["f", "file", "d", "directory", "s", "symlink"])66 .hide_possible_values(true)Code style udpatessharkdpbefore adoption34e4620
lines 67–70why, one step back67 .help("Filter by type: f(ile), d(irectory), s(ymlink)"),68 )69 .arg(70 Arg::with_name("extension")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 71–74why, one step back71 .long("extension")72 .short("e")73 .takes_value(true)74 .value_name("ext")Code style udpatessharkdpbefore adoption34e4620
lines 75–78why, one step back75 .help("Filter by file extension"),76 )77 .arg(78 Arg::with_name("color")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 79–81why, one step back79 .long("color")80 .short("c")81 .takes_value(true)Update help textsharkdpbefore adoption0aae4a3
line 82why, one step back82 .value_name("when")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 83–84why, one step back83 .possible_values(&["never", "auto", "always"])84 .hide_possible_values(true)Code style udpatessharkdpbefore adoption34e4620
lines 85–91why, one step back85 .help(86 "When to use color in the output:\n\87 never, auto, always (default: auto)",88 ),89 )90 .arg(91 Arg::with_name("threads")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 92–94why, one step back92 .long("threads")93 .short("j")94 .takes_value(true)Update help textsharkdpbefore adoption0aae4a3
line 95why, one step back95 .value_name("num")Code style udpatessharkdpbefore adoption34e4620
lines 96–102why, one step back96 .help(97 "Set number of threads to use for searching\n\98 (default: number of available CPU cores)",99 ),100 )101 .arg(102 Arg::with_name("max-buffer-time")Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
lines 103–105why, one step back103 .long("max-buffer-time")104 .takes_value(true)105 .hidden(true)Code style udpatessharkdpbefore adoption34e4620
lines 106–109why, one step back106 .help("the time (in ms) to buffer, before streaming to the console"),107 )108 .arg(Arg::with_name("pattern").help("the search pattern, a regular expression (optional)"))109 .arg(Arg::with_name("path").help("the root directory for the filesystem search (optional)"))Use clap to generate shell completionsFlorian Hofmairbefore adoption396b9ba
line 110why, one step back110}