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.

25 lines
760B

  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.check_external_links = true;
  11. // Disable syntax highlighting since the results won't be used
  12. // and this operation can be expensive.
  13. site.config.highlight_code = false;
  14. if let Some(b) = base_url {
  15. site.set_base_url(b.to_string());
  16. }
  17. site.load()?;
  18. console::notify_site_size(&site);
  19. console::warn_about_ignored_pages(&site);
  20. Ok(())
  21. }