mirror of
https://github.com/sharkdp/fd
synced 2024-10-06 07:49:18 +00:00
Update help message
This commit is contained in:
parent
9db4722010
commit
9aa4f0a124
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1,6 +1,6 @@
|
|||
[root]
|
||||
name = "fd"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "fd"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
authors = ["David Peter <mail@david-peter.de>"]
|
||||
|
||||
[dependencies]
|
||||
ansi_term = "0.9"
|
||||
getopts = "0.2"
|
||||
isatty = "0.1"
|
||||
regex = "0.2"
|
||||
walkdir = "1"
|
||||
ansi_term = "0.9"
|
||||
isatty = "0.1"
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -26,6 +26,8 @@ struct FdOptions {
|
|||
max_depth: usize
|
||||
}
|
||||
|
||||
const MAX_DEPTH_DEFAULT : usize = 25;
|
||||
|
||||
/// Print a search result to the console.
|
||||
fn print_entry(entry: &DirEntry, path_rel: &Path, config: &FdOptions) {
|
||||
let path_str = match path_rel.to_str() {
|
||||
|
@ -104,8 +106,9 @@ fn main() {
|
|||
opts.optflag("", "hidden",
|
||||
"search hidden files/directories (default: off)");
|
||||
opts.optflag("F", "follow", "follow symlinks (default: off)");
|
||||
opts.optflag("n", "no-color", "do not colorize output");
|
||||
opts.optopt("d", "max-depth", "maximum search depth", "DEPTH");
|
||||
opts.optflag("n", "no-color", "do not colorize output (default: on)");
|
||||
opts.optopt("d", "max-depth",
|
||||
"maximum search depth (default: 25)", "D");
|
||||
|
||||
let matches = match opts.parse(&args[1..]) {
|
||||
Ok(m) => m,
|
||||
|
@ -113,7 +116,7 @@ fn main() {
|
|||
};
|
||||
|
||||
if matches.opt_present("h") {
|
||||
let brief = "Usage: fd [PATTERN]";
|
||||
let brief = "Usage: fd [options] [PATTERN]";
|
||||
print!("{}", opts.usage(&brief));
|
||||
process::exit(1);
|
||||
}
|
||||
|
@ -141,7 +144,7 @@ fn main() {
|
|||
max_depth:
|
||||
matches.opt_str("max-depth")
|
||||
.and_then(|ds| usize::from_str_radix(&ds, 10).ok())
|
||||
.unwrap_or(25)
|
||||
.unwrap_or(MAX_DEPTH_DEFAULT)
|
||||
};
|
||||
|
||||
match RegexBuilder::new(pattern)
|
||||
|
|
Loading…
Reference in a new issue