Add support for the --no-create flag to the serve subcommand.

This commit is contained in:
Chris Spiegel 2017-11-27 20:08:37 -08:00
parent 1aa9c92ac1
commit 026eda915c
1 changed files with 7 additions and 0 deletions

View File

@ -29,6 +29,9 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
"-d, --dest-dir=[dest-dir] 'The output directory for \ "-d, --dest-dir=[dest-dir] 'The output directory for \
your book{n}(Defaults to ./book when omitted)'", 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("-p, --port=[port] 'Use another port{n}(Defaults to 3000)'")
.arg_from_usage( .arg_from_usage(
"-w, --websocket-port=[ws-port] 'Use another port for the \ "-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); 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 port = args.value_of("port").unwrap_or("3000");
let ws_port = args.value_of("websocket-port").unwrap_or("3001"); let ws_port = args.value_of("websocket-port").unwrap_or("3001");
let interface = args.value_of("interface").unwrap_or("localhost"); let interface = args.value_of("interface").unwrap_or("localhost");