zola/src/cmd/build.rs

27 lines
570 B
Rust
Raw Normal View History

use std::env;
2017-07-01 07:47:41 +00:00
use errors::Result;
use site::Site;
2016-12-13 06:22:24 +00:00
use console;
2016-12-06 08:27:03 +00:00
2019-08-24 20:23:08 +00:00
pub fn build(
config_file: &str,
base_url: Option<&str>,
output_dir: &str,
include_drafts: bool,
) -> Result<()> {
let mut site = Site::new(env::current_dir().unwrap(), config_file)?;
site.set_output_path(output_dir);
if let Some(b) = base_url {
site.set_base_url(b.to_string());
}
2019-08-24 20:23:08 +00:00
if include_drafts {
site.include_drafts();
}
2017-03-21 07:57:00 +00:00
site.load()?;
console::notify_site_size(&site);
console::warn_about_ignored_pages(&site);
2017-03-20 10:00:00 +00:00
site.build()
2016-12-13 09:05:59 +00:00
}