Skip to content

Commit 7e9131b

Browse files
committed
Allow serving any renderer's output
1 parent 1668ab7 commit 7e9131b

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
@@ -42,6 +42,15 @@ pub fn make_subcommand() -> Command {
4242
.value_parser(NonEmptyStringValueParser::new())
4343
.help("Port to use for HTTP connections"),
4444
)
45+
.arg(
46+
Arg::new("renderer")
47+
.short('r')
48+
.long("renderer")
49+
.num_args(1)
50+
.default_value("html")
51+
.value_parser(NonEmptyStringValueParser::new())
52+
.help("Renderer to serve the output of"),
53+
)
4554
.arg_open()
4655
}
4756

@@ -52,6 +61,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
5261

5362
let port = args.get_one::<String>("port").unwrap();
5463
let hostname = args.get_one::<String>("hostname").unwrap();
64+
let renderer = args.get_one::<String>("renderer").unwrap();
5565
let open_browser = args.get_flag("open");
5666

5767
let address = format!("{}:{}", hostname, port);
@@ -73,7 +83,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
7383
.to_socket_addrs()?
7484
.next()
7585
.ok_or_else(|| anyhow::anyhow!("no address found for {}", address))?;
76-
let build_dir = book.build_dir_for("html");
86+
let build_dir = book.build_dir_for(renderer);
7787
let input_404 = book
7888
.config
7989
.get("output.html.input-404")

0 commit comments

Comments
 (0)