2017-06-26 07:24:33 +08:00
|
|
|
use clap::{ArgMatches, SubCommand, App};
|
|
|
|
use mdbook::MDBook;
|
2017-06-27 05:17:46 +08:00
|
|
|
use mdbook::errors::Result;
|
2017-06-26 07:24:33 +08:00
|
|
|
use get_book_dir;
|
|
|
|
|
|
|
|
// test command implementation
|
2017-06-27 05:11:00 +08:00
|
|
|
pub fn test(args: &ArgMatches) -> Result<()> {
|
2017-06-26 07:24:33 +08:00
|
|
|
let book_dir = get_book_dir(args);
|
|
|
|
let mut book = MDBook::new(&book_dir).read_config()?;
|
|
|
|
|
|
|
|
book.test()?;
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> {
|
|
|
|
SubCommand::with_name("test").about("Test that code samples compile")
|
|
|
|
}
|