diff --git a/CHANGELOG.md b/CHANGELOG.md index b863b09..7022b8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # 0.9.6 (2020-05-18) -- Fix windows builds -- Move to Github Actions instead of Travis +- Fix windows builds +- Case insensitive file extension matching +- Move to Github Actions instead of Travis # 0.9.5 (2020-04-08) diff --git a/Cargo.lock b/Cargo.lock index 468ea77..9bbbacf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,7 +1008,7 @@ dependencies = [ [[package]] name = "ripgrep_all" -version = "0.9.13-alpha.0" +version = "0.9.6-alpha.0" dependencies = [ "bincode", "bzip2", diff --git a/src/bin/rga.rs b/src/bin/rga.rs index a0cc599..e0c844c 100644 --- a/src/bin/rga.rs +++ b/src/bin/rga.rs @@ -1,4 +1,5 @@ use failure::Fallible; +use log::*; use rga::adapters::spawning::map_exe_error; use rga::adapters::*; use rga::args::*; @@ -75,8 +76,8 @@ fn main() -> Result<(), exitfailure::ExitFailure> { let extensions = adapters .iter() .flat_map(|a| &a.metadata().fast_matchers) - .filter_map(|m| match m { - FastMatcher::FileExtension(ext) => Some(ext as &str), + .flat_map(|m| match m { + FastMatcher::FileExtension(ext) => vec![ext.clone(), ext.to_ascii_uppercase()], }) .collect::>() .join(","); @@ -94,10 +95,13 @@ fn main() -> Result<(), exitfailure::ExitFailure> { "--smart-case", ]; + let exe = std::env::current_exe().expect("Could not get executable location"); + let preproc_exe = exe.with_file_name("rga-preproc"); + let mut child = Command::new("rg") .args(rg_args) .arg("--pre") - .arg("rga-preproc") + .arg(preproc_exe) .arg("--pre-glob") .arg(pre_glob) .args(passthrough_args) @@ -108,7 +112,7 @@ fn main() -> Result<(), exitfailure::ExitFailure> { Ok(()) } -/// add the directory that contains `rga` to PATH, so ripgrep can find rga-preproc and rga-preproc can find pandoc etc (if we are on Windows where we include dependent binaries) +/// add the directory that contains `rga` to PATH, so rga-preproc can find pandoc etc (if we are on Windows where we include dependent binaries) fn add_exe_to_path() -> Fallible<()> { use std::env; let mut exe = env::current_exe().expect("Could not get executable location"); diff --git a/src/matching.rs b/src/matching.rs index 71a7d4b..f7b3809 100644 --- a/src/matching.rs +++ b/src/matching.rs @@ -42,7 +42,7 @@ pub struct FileMeta { } pub fn extension_to_regex(extension: &str) -> Regex { - Regex::new(&format!("\\.{}$", ®ex::escape(extension))).expect("we know this regex compiles") + Regex::new(&format!("(?i)\\.{}$", ®ex::escape(extension))).expect("we know this regex compiles") } pub fn adapter_matcher>(