git_global/subcommands/
ignore.rs1use crate::config::Config;
4use crate::errors::{GitGlobalError, Result};
5use crate::report::Report;
6
7pub fn execute(_config: Config, pattern: &str) -> Result<Report> {
9 let mut report = Report::new(&[]);
10 match Config::add_ignore_pattern(pattern) {
11 Ok(()) => {
12 report.add_message(format!(
13 "Added '{}' to global.ignore. Run `git global scan` to update the cache.",
14 pattern
15 ));
16 }
17 Err(e) => {
18 return Err(GitGlobalError::BadSubcommand(e));
19 }
20 }
21 Ok(report)
22}