mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-13 22:32:35 +00:00
ignore now takes a value
This commit is contained in:
parent
86d390032b
commit
8ec0bf6e30
1 changed files with 11 additions and 5 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue