Skip to content

Commit ce2ba61

Browse files
committed
Allow serving any renderer's output
1 parent 2213312 commit ce2ba61

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/cmd/serve.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
4848
.empty_values(false)
4949
.help("Port to use for HTTP connections"),
5050
)
51+
.arg(
52+
Arg::with_name("renderer")
53+
.short("r")
54+
.long("renderer")
55+
.takes_value(true)
56+
.default_value("html")
57+
.empty_values(false)
58+
.help("Renderer to serve the output of"),
59+
)
5160
.arg_from_usage("-o, --open 'Opens the book server in a web browser'")
5261
}
5362

@@ -58,6 +67,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
5867

5968
let port = args.value_of("port").unwrap();
6069
let hostname = args.value_of("hostname").unwrap();
70+
let renderer = args.value_of("renderer").unwrap();
6171
let open_browser = args.is_present("open");
6272

6373
let address = format!("{}:{}", hostname, port);
@@ -80,7 +90,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
8090
.to_socket_addrs()?
8191
.next()
8292
.ok_or_else(|| anyhow::anyhow!("no address found for {}", address))?;
83-
let build_dir = book.build_dir_for("html");
93+
let build_dir = book.build_dir_for(renderer);
8494
let input_404 = book
8595
.config
8696
.get("output.html.input-404")

0 commit comments

Comments
 (0)