extern crate clap; extern crate comrak; extern crate fs_extra; #[macro_use] extern crate lazy_static; extern crate notify; extern crate regex; extern crate toml; extern crate uuid; use clap::{App, Arg}; use commands::{build, new, watch}; mod commands; mod config; mod post; mod render; mod write; fn main() { let matches = App::new("tlon") .version("0.1.0") .author("Dylan Baker") .about("Highly opinionated static site generator") .arg( Arg::with_name("command") .required(true) .possible_values(&["build", "new", "watch"]) .index(1), ).arg( Arg::with_name("name") .required_if("command", "new") .index(2), ).get_matches(); let command = matches.value_of("command").unwrap(); if command == "build" { build(); } else if command == "new" { new(&matches.value_of("name").unwrap()); } else if command == "watch" { build(); watch().expect("Error while watching posts directory"); } }