Skip to content

Commit

Permalink
Always open index page with serve --open
Browse files Browse the repository at this point in the history
  • Loading branch information
ISSOtm committed Jun 23, 2022
1 parent 2f5e89f commit 6736401
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/cmd/serve.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(feature = "watch")]
use super::watch;
use crate::{first_chapter, get_book_dir, open};
use crate::{get_book_dir, open};
use clap::{arg, App, Arg, ArgMatches};
use futures_util::sink::SinkExt;
use futures_util::StreamExt;
Expand Down Expand Up @@ -103,10 +103,7 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
});

if open_browser {
let serving_url = match first_chapter(&book).map(|path| path.with_extension("html")) {
Some(path) => format!("http://{}/{}", address, path.display()),
_ => format!("http://{}", address),
};
let serving_url = format!("http://{}", address);
info!("Serving on: {}", serving_url);
open(serving_url);
}
Expand Down

0 comments on commit 6736401

Please sign in to comment.