summaryrefslogtreecommitdiffstats
path: root/src/commands/select_string.rs
blob: 61495f74c41ca32f41a1de7188dcc5e3f5166097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::context::{AppContext, MatchContext};
use crate::error::AppResult;

use super::select::{self, SelectOption};

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

    let select_context = if !pattern.is_empty() {
        MatchContext::new_string(pattern, case_sensitivity)
    } else {
        MatchContext::None
    };

    select::select_files(context, &select_context, options)
}