cfg.rs 577 B

123456789101112131415161718192021222324
  1. extern crate clap;
  2. use constants;
  3. pub struct Cfg {
  4. pub file_path: Option<String>,
  5. }
  6. pub fn ducartes_args() -> Cfg {
  7. let matches =
  8. clap::App::new(constants::PROGRAM_NAME)
  9. .version(constants::PROGRAM_VERSION)
  10. .author(constants::PROGRAM_AUTHOR)
  11. .arg(clap::Arg::with_name("i")
  12. .short("i")
  13. .long("input")
  14. .value_name("FILE")
  15. .help("The document to load on starting"))
  16. .get_matches();
  17. let file_path = matches.value_of("input").map(|x| x.to_owned());
  18. Cfg { file_path }
  19. }