git-meta-cli 0.1.11

Command-line tool for structured Git metadata (get/set, serialize, materialize, push/pull). Installs the `git-meta` binary.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::Result;

use crate::context::CommandContext;

pub(crate) fn run(pattern: &str) -> Result<()> {
    let ctx = CommandContext::open(None)?;
    let removed = ctx.session.clear_key_prefix(pattern)?;

    if removed == 0 {
        eprintln!("no keys matching '{pattern}' found");
    } else {
        let noun = if removed == 1 { "entry" } else { "entries" };
        println!("cleared {removed} {noun}");
    }

    Ok(())
}