You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
608B

  1. use std::env;
  2. use std::path::PathBuf;
  3. use errors::Result;
  4. use site::Site;
  5. use console;
  6. pub fn check(config_file: &str, base_path: Option<&str>, base_url: Option<&str>) -> Result<()> {
  7. let bp = base_path.map(PathBuf::from).unwrap_or_else(|| env::current_dir().unwrap());
  8. let mut site = Site::new(bp, config_file)?;
  9. // Force the checking of external links
  10. site.config.enable_check_mode();
  11. if let Some(b) = base_url {
  12. site.set_base_url(b.to_string());
  13. }
  14. site.load()?;
  15. console::notify_site_size_simple(&site);
  16. console::warn_about_ignored_pages(&site);
  17. Ok(())
  18. }