-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --title option and --gitignore flag to mdbook init #1559
Conversation
add init flags update init command in guide
18f9f78
to
e5e10c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/cmd/init.rs
Outdated
@@ -18,14 +18,27 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { | |||
) | |||
.arg_from_usage("--theme 'Copies the default theme into your source folder'") | |||
.arg_from_usage("--force 'Skips confirmation prompts'") | |||
.arg( | |||
Arg::with_name("title") | |||
.short("t") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably drop the short flags for now. Unless an option is extremely common, I find it is generally more readable to use the long form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the short values for ignore and title.
src/cmd/init.rs
Outdated
println!("\nDo you want a .gitignore to be created? (y/n)"); | ||
|
||
if confirm() { | ||
if args.is_present("gitignore") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There doesn't appear to be a way to pass "no" on the command-line for gitignore. Perhaps the flag should take a value? Maybe something like --ignore=git
or --ignore=none
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arg is now --ingore
and it either takes the value git
(creates a .gitignore), none
doesn't create a .gitignore, or if neither is present, the user is prompted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
I pushed a small change to update the CLI docs, too.
Adds two new flags to
mdbook init
;--title
and--gitignore
.These flags optionally replace the two currently interactive prompts so that a book can be initialized without any prompts if desired.
See #1556.