|
@ -65,7 +65,7 @@ pub enum Command { |
|
|
/// Add a line to the gitignore
|
|
|
/// Add a line to the gitignore
|
|
|
Add {
|
|
|
Add {
|
|
|
/// The glob string that should be added
|
|
|
/// The glob string that should be added
|
|
|
glob: String,
|
|
|
|
|
|
|
|
|
glob: Vec<String>,
|
|
|
/// Add the entry to the repo local ignore file
|
|
|
/// Add the entry to the repo local ignore file
|
|
|
#[structopt(short)]
|
|
|
#[structopt(short)]
|
|
|
local: bool,
|
|
|
local: bool,
|
|
@ -90,7 +90,13 @@ pub enum Command { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// Runs the command `add`
|
|
|
/// Runs the command `add`
|
|
|
fn run_add(glob: &str, local: bool) -> Result<()> {
|
|
|
|
|
|
|
|
|
fn run_add(glob: Vec<String>, 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);
|
|
|
trace!("running command `add` with glob '{}'", &glob);
|
|
|
let root = match git_dir()? {
|
|
|
let root = match git_dir()? {
|
|
|
Some(r) => r,
|
|
|
Some(r) => r,
|
|
@ -165,7 +171,7 @@ fn run_dump_completion(shell: Option<structopt::clap::Shell>) -> Result<()> { |
|
|
/// The actual `main()`
|
|
|
/// The actual `main()`
|
|
|
pub fn main(opts: CliOpts) -> Result<()> {
|
|
|
pub fn main(opts: CliOpts) -> Result<()> {
|
|
|
match opts.cmd {
|
|
|
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::Get { lang, append } => run_get(&lang, append)?,
|
|
|
Command::ListTemplates => run_list_templates()?,
|
|
|
Command::ListTemplates => run_list_templates()?,
|
|
|
Command::DumpCompletions { shell } => run_dump_completion(shell)?,
|
|
|
Command::DumpCompletions { shell } => run_dump_completion(shell)?,
|
|
|