bctx-weave 0.1.6

bctx-weave — FilterMesh lens pipeline, CLI interception, domain compression
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::Recipe;

pub struct CompiledRecipe {
    pub recipe: Recipe,
    pub matcher: regex::Regex,
}

impl CompiledRecipe {
    pub fn compile(recipe: Recipe) -> anyhow::Result<Self> {
        let matcher = regex::Regex::new(&recipe.match_command)?;
        Ok(Self { recipe, matcher })
    }

    pub fn matches(&self, command: &str) -> bool {
        self.matcher.is_match(command)
    }
}