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.

47 lines
1.8KB

  1. use clap::{App, AppSettings, Arg, SubCommand};
  2. pub fn build_cli() -> App<'static, 'static> {
  3. App::new("gutenberg")
  4. .version(crate_version!())
  5. .author(crate_authors!())
  6. .about(crate_description!())
  7. .setting(AppSettings::SubcommandRequiredElseHelp)
  8. .arg(
  9. Arg::with_name("config")
  10. .short("c")
  11. .long("config")
  12. .help("Path to a config file other than config.toml")
  13. )
  14. .subcommands(vec![
  15. SubCommand::with_name("init")
  16. .about("Create a new Gutenberg project")
  17. .arg(
  18. Arg::with_name("name")
  19. .required(true)
  20. .help("Name of the project. Will create a new directory with that name in the current directory")
  21. ),
  22. SubCommand::with_name("build")
  23. .about("Builds the site")
  24. .args(&[
  25. Arg::with_name("base_url")
  26. .short("u")
  27. .long("base-url")
  28. .help("Force the base URL to be that value (default to the one in config.toml)"),
  29. ]),
  30. SubCommand::with_name("serve")
  31. .about("Serve the site. Rebuild and reload on change automatically")
  32. .args(&[
  33. Arg::with_name("interface")
  34. .short("i")
  35. .long("interface")
  36. .default_value("127.0.0.1")
  37. .help("Interface to bind on"),
  38. Arg::with_name("port")
  39. .short("p")
  40. .long("port")
  41. .default_value("1111")
  42. .help("Which port to use"),
  43. ]),
  44. ])
  45. }