call first_chapter
This commit is contained in:
parent
29c729fd23
commit
8b49600673
|
@ -1,3 +1,4 @@
|
|||
use crate::first_chapter;
|
||||
use crate::{get_book_dir, open};
|
||||
use clap::{arg, App, Arg, ArgMatches};
|
||||
use mdbook::errors::Result;
|
||||
|
@ -45,7 +46,12 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
|
|||
|
||||
if args.is_present("open") {
|
||||
book.build()?;
|
||||
open(book.build_dir_for("html").join("index.html"));
|
||||
match first_chapter(&book)
|
||||
.map(|path| book.build_dir_for("html").join(path).with_extension("html"))
|
||||
{
|
||||
Some(path) if Path::new(&path).exists() => open(path),
|
||||
_ => warn!("No chapter available to open"),
|
||||
}
|
||||
}
|
||||
|
||||
trigger_on_change(&book, |paths, book_dir| {
|
||||
|
|
Loading…
Reference in New Issue