Skip to content

Commit 7279ad2

Browse files
committed
Allow serving any renderer's output
1 parent 23abd20 commit 7279ad2

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