summaryrefslogtreecommitdiffstats
path: root/src/commands/filter_regex.rs
blob: 70697287e28911154e60bf7da27c8e6325456b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::context::{AppContext, MatchContext};
use crate::error::AppResult;

use super::filter;

pub fn filter_regex(context: &mut AppContext, pattern: &str) -> AppResult {
    let case_sensitivity = context
        .config_ref()
        .search_options_ref()
        .regex_case_sensitivity;

    let filter_context = MatchContext::new_regex(pattern, case_sensitivity)?;
    filter::filter(context, filter_context)
}