A static site generator written in Rust
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.

main.rs 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. extern crate clap;
  2. extern crate comrak;
  3. extern crate fs_extra;
  4. #[macro_use]
  5. extern crate lazy_static;
  6. extern crate notify;
  7. extern crate regex;
  8. extern crate toml;
  9. extern crate uuid;
  10. use clap::{App, Arg};
  11. use commands::{build, new, watch};
  12. mod commands;
  13. mod config;
  14. mod post;
  15. mod render;
  16. mod write;
  17. fn main() {
  18. let matches = App::new("tlon")
  19. .version("0.1.0")
  20. .author("Dylan Baker")
  21. .about("Highly opinionated static site generator")
  22. .arg(
  23. Arg::with_name("command")
  24. .required(true)
  25. .possible_values(&["build", "new", "watch"])
  26. .index(1),
  27. ).arg(
  28. Arg::with_name("name")
  29. .required_if("command", "new")
  30. .index(2),
  31. ).get_matches();
  32. let command = matches.value_of("command").unwrap();
  33. if command == "build" {
  34. build();
  35. } else if command == "new" {
  36. new(&matches.value_of("name").unwrap());
  37. } else if command == "watch" {
  38. build();
  39. watch().expect("Error while watching posts directory");
  40. }
  41. }