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.

40 lines
1.0KB

  1. // `error_chain!` can recurse deeply
  2. #![recursion_limit = "1024"]
  3. #[macro_use] extern crate clap;
  4. #[macro_use] extern crate error_chain;
  5. mod config;
  6. mod errors;
  7. mod cmd;
  8. fn main() {
  9. let matches = clap_app!(myapp =>
  10. (version: crate_version!())
  11. (author: "Vincent Prouillet")
  12. (about: "Static site generator")
  13. (@setting SubcommandRequiredElseHelp)
  14. (@subcommand new =>
  15. (about: "Create a new Gutenberg project")
  16. (@arg name: +required "Name of the project. Will create a directory with that name in the current directory")
  17. )
  18. ).get_matches();
  19. match matches.subcommand() {
  20. ("new", Some(matches)) => {
  21. match cmd::create_new_project(matches.value_of("name").unwrap()) {
  22. Ok(()) => {
  23. println!("Project created");
  24. },
  25. Err(e) => {
  26. println!("Error: {}", e);
  27. ::std::process::exit(1);
  28. },
  29. };
  30. },
  31. _ => unreachable!(),
  32. }
  33. }