From 026eda915c0713fcea739a9d1317c38e64d36116 Mon Sep 17 00:00:00 2001 From: Chris Spiegel Date: Mon, 27 Nov 2017 20:08:37 -0800 Subject: [PATCH] Add support for the --no-create flag to the serve subcommand. --- src/bin/serve.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/serve.rs b/src/bin/serve.rs index 87099411..87c26b01 100644 --- a/src/bin/serve.rs +++ b/src/bin/serve.rs @@ -29,6 +29,9 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { "-d, --dest-dir=[dest-dir] 'The output directory for \ your book{n}(Defaults to ./book when omitted)'", ) + .arg_from_usage( + "--no-create 'Will not create non-existent files linked from SUMMARY.md'", + ) .arg_from_usage("-p, --port=[port] 'Use another port{n}(Defaults to 3000)'") .arg_from_usage( "-w, --websocket-port=[ws-port] 'Use another port for the \ @@ -55,6 +58,10 @@ pub fn execute(args: &ArgMatches) -> Result<()> { book.config.book.build_dir = PathBuf::from(dest_dir); } + if args.is_present("no-create") { + book.create_missing = false; + } + let port = args.value_of("port").unwrap_or("3000"); let ws_port = args.value_of("websocket-port").unwrap_or("3001"); let interface = args.value_of("interface").unwrap_or("localhost");