summaryrefslogtreecommitdiffstats
path: root/src/commands/select_regex.rs
blob: 1ebfefbbd08802d7a20bd925ca6cc213c9d98708 (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::select::{self, SelectOption};

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

    let select_context = MatchContext::new_regex(pattern, case_sensitivity)?;
    select::select_files(context, &select_context, options)
}