|
@ -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: Vec<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,
|
|
@ -78,7 +78,7 @@ pub enum Command { |
|
|
/// The language for which the gitignore should be downloaded
|
|
|
/// The language for which the gitignore should be downloaded
|
|
|
///
|
|
|
///
|
|
|
/// A list with all available languages and projects can be printed with `list-templates`.
|
|
|
/// A list with all available languages and projects can be printed with `list-templates`.
|
|
|
lang: String,
|
|
|
|
|
|
|
|
|
lang: String,
|
|
|
},
|
|
|
},
|
|
|
/// List all available templates that can be downloaded
|
|
|
/// List all available templates that can be downloaded
|
|
|
ListTemplates,
|
|
|
ListTemplates,
|
|
@ -107,7 +107,10 @@ fn add(glob: &str, local: bool) -> Result<()> { |
|
|
info!("Working with git root in {:?}", root);
|
|
|
info!("Working with git root in {:?}", root);
|
|
|
|
|
|
|
|
|
let mut file_path = PathBuf::from(&root);
|
|
|
let mut file_path = PathBuf::from(&root);
|
|
|
if local {
|
|
|
|
|
|
|
|
|
let override_path = std::env::var("GITIG_OVERRIDE_PATH").ok();
|
|
|
|
|
|
if let Some(override_path) = override_path {
|
|
|
|
|
|
file_path = PathBuf::from(override_path);
|
|
|
|
|
|
} else if local {
|
|
|
file_path.push(".git/info/exclude")
|
|
|
file_path.push(".git/info/exclude")
|
|
|
} else {
|
|
|
} else {
|
|
|
file_path.push(".gitignore");
|
|
|
file_path.push(".gitignore");
|
|
|