diff --git a/src/app.rs b/src/app.rs index 481b538..703a4d2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -65,7 +65,7 @@ pub enum Command { /// Add a line to the gitignore Add { /// The glob string that should be added - glob: String, + glob: Vec, /// Add the entry to the repo local ignore file #[structopt(short)] local: bool, @@ -90,7 +90,13 @@ pub enum Command { } /// Runs the command `add` -fn run_add(glob: &str, local: bool) -> Result<()> { +fn run_add(glob: Vec, local: bool) -> Result<()> { + for g in glob { + add(&g, local)?; + } + Ok(()) +} +fn add(glob: &str, local: bool) -> Result<()> { trace!("running command `add` with glob '{}'", &glob); let root = match git_dir()? { Some(r) => r, @@ -165,7 +171,7 @@ fn run_dump_completion(shell: Option) -> Result<()> { /// The actual `main()` pub fn main(opts: CliOpts) -> Result<()> { match opts.cmd { - Command::Add { glob, local } => run_add(&glob, local)?, + Command::Add { glob, local } => run_add(glob, local)?, Command::Get { lang, append } => run_get(&lang, append)?, Command::ListTemplates => run_list_templates()?, Command::DumpCompletions { shell } => run_dump_completion(shell)?,