diff --git a/src/app.rs b/src/app.rs index 80a8c0d..7b70004 100644 --- a/src/app.rs +++ b/src/app.rs @@ -122,11 +122,11 @@ struct Options { color_when: Option, #[arg( - short = 's', - long = "skip-errors", + short = 'e', + long = "allow-empty", help = "Exits without error when no matches are found." )] - skip_errors: bool, + allow_empty: bool, } fn regex_query_or_die(pattern: &str, replacement: &str, word: bool) -> Query { @@ -209,7 +209,7 @@ pub fn run() -> Result<()> { selected_file_types, preserve_case, word_regex, - skip_errors + allow_empty } = opt; let dry_run = !go; @@ -238,7 +238,7 @@ pub fn run() -> Result<()> { ignored, selected_file_types, ignored_file_types, - skip_errors + allow_empty }; let path = path.unwrap_or_else(|| Path::new(".").to_path_buf()); @@ -274,7 +274,7 @@ fn run_on_directory( directory_patcher.run(&query)?; let stats = directory_patcher.stats(); if stats.total_replacements() == 0 { - match settings.skip_errors { + match settings.allow_empty { true => { console.print_message(&format!( "{}", diff --git a/src/settings.rs b/src/settings.rs index f99820e..412d9e8 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -16,5 +16,5 @@ pub struct Settings { /// List of file types to ignore (default: empty) pub ignored_file_types: Vec, /// Exits without an error when no matches are found (default: false) - pub skip_errors: bool, + pub allow_empty: bool, }