ignore now takes a value

This commit is contained in:
josh rotenberg 2021-07-04 11:57:46 -07:00
parent 86d390032b
commit 8ec0bf6e30

View file

@ -26,9 +26,12 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
.required(false), .required(false),
) )
.arg( .arg(
Arg::with_name("gitignore") Arg::with_name("ignore")
.long("gitignore") .long("ignore")
.help("Creates a .gitignore"), .takes_value(true)
.possible_values(&["none", "git"])
.help("Creates a VCS ignore file (i.e. .gitignore)")
.required(false),
) )
} }
@ -56,8 +59,11 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
} }
} }
if args.is_present("gitignore") { if let Some(ignore) = args.value_of("ignore") {
builder.create_gitignore(true); match ignore {
"git" => builder.create_gitignore(true),
_ => builder.create_gitignore(false)
};
} else { } else {
println!("\nDo you want a .gitignore to be created? (y/n)"); println!("\nDo you want a .gitignore to be created? (y/n)");
if confirm() { if confirm() {