zola/src/cmd/build.rs

26 lines
593 B
Rust
Raw Normal View History

use std::env;
use std::path::PathBuf;
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
pub fn build(
config_file: &str,
base_path: Option<&str>,
base_url: Option<&str>,
output_dir: &str,
) -> Result<()> {
let bp = base_path.map(PathBuf::from).unwrap_or(env::current_dir().unwrap());
let mut site = Site::new(bp, config_file)?;
site.set_output_path(output_dir);
if let Some(b) = base_url {
site.set_base_url(b.to_string());
}
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
}