Skip to content

Commit

Permalink
Allow empty is probably a less confusing name
Browse files Browse the repository at this point in the history
  • Loading branch information
roqvist committed Sep 20, 2024
1 parent 8714e27 commit 4f7e008
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ struct Options {
color_when: Option<ColorWhen>,

#[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 {
Expand Down Expand Up @@ -209,7 +209,7 @@ pub fn run() -> Result<()> {
selected_file_types,
preserve_case,
word_regex,
skip_errors
allow_empty
} = opt;

let dry_run = !go;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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!(
"{}",
Expand Down
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ pub struct Settings {
/// List of file types to ignore (default: empty)
pub ignored_file_types: Vec<String>,
/// Exits without an error when no matches are found (default: false)
pub skip_errors: bool,
pub allow_empty: bool,
}

0 comments on commit 4f7e008

Please sign in to comment.