Skip to content
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

Merged
merged 5 commits into from
Jul 6, 2021

Conversation

joshrotenberg
Copy link
Contributor

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.

add init flags

update init command in guide
Copy link

@msathis msathis left a 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")
Copy link
Contributor

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.

Copy link
Contributor Author

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") {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@ehuss ehuss left a 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.

@ehuss ehuss merged commit 56652e8 into rust-lang:master Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants