mirror of
https://github.com/jht5945/finding.git
synced 2025-12-27 13:20:03 +08:00
add --skip-target-dir
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -127,7 +127,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "finding"
|
name = "finding"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argparse 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"argparse 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rust_util 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rust_util 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "finding"
|
name = "finding"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "command line finding tool"
|
description = "command line finding tool"
|
||||||
|
|||||||
@@ -201,7 +201,16 @@ fn find_text_files(options: &Options, dir_path: &Path) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if options.skip_target_dir && p_str.ends_with("/target") {
|
||||||
|
if options.verbose {
|
||||||
|
clear_n_print_message(MessageType::INFO, &format!("Skip target dir: {}", p_str));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if options.skip_dot_dir && p_str.contains("/.") {
|
if options.skip_dot_dir && p_str.contains("/.") {
|
||||||
|
if options.verbose {
|
||||||
|
clear_n_print_message(MessageType::INFO, &format!("Skip dot(.) dir: {}", p_str));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if options.skip_link_dir && is_symlink(p) {
|
if options.skip_link_dir && is_symlink(p) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ pub struct Options {
|
|||||||
pub scan_dot_git: bool,
|
pub scan_dot_git: bool,
|
||||||
pub skip_dot_dir: bool,
|
pub skip_dot_dir: bool,
|
||||||
pub skip_link_dir: bool,
|
pub skip_link_dir: bool,
|
||||||
|
pub skip_target_dir: bool,
|
||||||
pub filter_file_name: String,
|
pub filter_file_name: String,
|
||||||
pub filter_line_content: String,
|
pub filter_line_content: String,
|
||||||
pub verbose: bool,
|
pub verbose: bool,
|
||||||
@@ -41,6 +42,7 @@ impl Options {
|
|||||||
scan_dot_git: false,
|
scan_dot_git: false,
|
||||||
skip_dot_dir: false,
|
skip_dot_dir: false,
|
||||||
skip_link_dir: false,
|
skip_link_dir: false,
|
||||||
|
skip_target_dir: false,
|
||||||
filter_file_name: String::new(),
|
filter_file_name: String::new(),
|
||||||
filter_line_content: String::new(),
|
filter_line_content: String::new(),
|
||||||
verbose: false,
|
verbose: false,
|
||||||
@@ -63,6 +65,7 @@ impl Options {
|
|||||||
ap.refer(&mut self.scan_dot_git).add_option(&["--scan-dot-git"], StoreTrue, "Scan dot git");
|
ap.refer(&mut self.scan_dot_git).add_option(&["--scan-dot-git"], StoreTrue, "Scan dot git");
|
||||||
ap.refer(&mut self.skip_dot_dir).add_option(&["--skip-dot-dir"], StoreTrue, "Skipt dot dir [Text Mode]");
|
ap.refer(&mut self.skip_dot_dir).add_option(&["--skip-dot-dir"], StoreTrue, "Skipt dot dir [Text Mode]");
|
||||||
ap.refer(&mut self.skip_link_dir).add_option(&["--skip-link-dir"], StoreTrue, "Skip link dir");
|
ap.refer(&mut self.skip_link_dir).add_option(&["--skip-link-dir"], StoreTrue, "Skip link dir");
|
||||||
|
ap.refer(&mut self.skip_target_dir).add_option(&["--skip-target-dir"], StoreTrue, "Skip target dir");
|
||||||
ap.refer(&mut self.filter_file_name).add_option(&["--filter-file-name"], Store, "Filter file name [Text Mode]");
|
ap.refer(&mut self.filter_file_name).add_option(&["--filter-file-name"], Store, "Filter file name [Text Mode]");
|
||||||
ap.refer(&mut self.filter_line_content).add_option(&["--filter-line-content"], Store, "Filter line content [Text Mode]");
|
ap.refer(&mut self.filter_line_content).add_option(&["--filter-line-content"], Store, "Filter line content [Text Mode]");
|
||||||
ap.refer(&mut self.version).add_option(&["-v", "--version"], StoreTrue, "Print version");
|
ap.refer(&mut self.version).add_option(&["-v", "--version"], StoreTrue, "Print version");
|
||||||
|
|||||||
Reference in New Issue
Block a user