From 14457da4f831c57e7a2b1c54e1c37adb8354c8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Sat, 25 Feb 2023 00:28:45 +0100 Subject: xtask: Add book building --- xtask/src/main.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'xtask/src/main.rs') diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 2c37f82..d881224 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -154,6 +154,9 @@ enum Commands { /// Build docs Doc, + + /// Build books with mdbook + Book, } #[derive(Args, Debug)] @@ -400,6 +403,10 @@ fn main() -> anyhow::Result<()> { info!("Running cargo doc on backend: {backend:?}"); cargo_doc(&cargologlevel, backend)?; } + Commands::Book => { + info!("Running mdbook build"); + cargo_book(&cargologlevel)?; + } } Ok(()) @@ -534,6 +541,16 @@ fn cargo_doc(cargoarg: &Option<&str>, backend: Backends) -> anyhow::Result<()> { Ok(()) } +fn cargo_book(cargoarg: &Option<&str>) -> anyhow::Result<()> { + command_parser( + &CargoCommand::Book { + mdbookarg: cargoarg, + }, + false, + )?; + Ok(()) +} + fn run_test( cargoarg: &Option<&str>, backend: Backends, @@ -680,13 +697,14 @@ fn command_parser(command: &CargoCommand, overwrite: bool) -> anyhow::Result<()> } Ok(()) } - CargoCommand::ExampleBuild { .. } + CargoCommand::Format { .. } | CargoCommand::ExampleCheck { .. } - | CargoCommand::Build { .. } + | CargoCommand::ExampleBuild { .. } | CargoCommand::Check { .. } + | CargoCommand::Build { .. } | CargoCommand::Clippy { .. } | CargoCommand::Doc { .. } - | CargoCommand::Format { .. } + | CargoCommand::Book { .. } | CargoCommand::ExampleSize { .. } => { let cargo_result = run_command(command)?; if let Some(exit_code) = cargo_result.exit_status.code() { -- cgit v1.2.3