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 940B

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