about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-06-20 11:04:34 -0700
committerMichael Howell <michael@notriddle.com>2022-07-09 09:49:05 -0700
commit921aa50d184e6ccd4a9dd7fc8bf4f6393f30b3f7 (patch)
treed14b1f7a52a83142b61a9eccc22e8b3ea3a8240d
parent271bad9b08ec51cfd9236359b9fe6234e7fe4d48 (diff)
downloadrust-921aa50d184e6ccd4a9dd7fc8bf4f6393f30b3f7.tar.gz
rust-921aa50d184e6ccd4a9dd7fc8bf4f6393f30b3f7.zip
Fix epage's nits
* Use real newlines in command descriptions
* Make `--dest-dir` optional
* Show help message when no subcommand is supplied
-rw-r--r--src/tools/rustbook/src/main.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs
index fe7d8d9afe3..3c7dc0183d7 100644
--- a/src/tools/rustbook/src/main.rs
+++ b/src/tools/rustbook/src/main.rs
@@ -12,15 +12,17 @@ fn main() {
     let crate_version = format!("v{}", crate_version!());
     env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init();
     let d_arg = arg!(-d --"dest-dir" <DEST_DIR>
-"The output directory for your book{n}(Defaults to ./book when omitted)");
+"The output directory for your book\n(Defaults to ./book when omitted)")
+    .required(false);
     let dir_arg = arg!([dir]
-"A directory for your book{n}(Defaults to Current Directory when omitted)");
+"A directory for your book\n(Defaults to Current Directory when omitted)");
 
     let matches = Command::new("rustbook")
         .about("Build a book with mdBook")
         .author("Steve Klabnik <steve@steveklabnik.com>")
         .version(&*crate_version)
         .subcommand_required(true)
+        .arg_required_else_help(true)
         .subcommand(
             Command::new("build")
                 .about("Build the book from the markdown files")