A simple map viewer

args.rs 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. use clap;
  2. use clap::Arg;
  3. pub fn parse<'a>() -> clap::ArgMatches<'a> {
  4. clap::App::new("DeltaMap")
  5. .version(crate_version!())
  6. .author(crate_authors!())
  7. .about(crate_description!())
  8. .arg(Arg::with_name("config")
  9. .short("c")
  10. .long("config")
  11. .value_name("FILE")
  12. .help("Set a custom config file")
  13. .takes_value(true))
  14. .arg(Arg::with_name("tile-sources")
  15. .short("t")
  16. .long("tile-sources")
  17. .value_name("FILE")
  18. .help("Set a custom tile sources file")
  19. .takes_value(true))
  20. .arg(Arg::with_name("fps")
  21. .long("fps")
  22. .value_name("FPS")
  23. .validator(|s| {
  24. s.parse::<f64>()
  25. .map(|_| ())
  26. .map_err(|e| format!("{}", e))
  27. })
  28. .help("Set target frames per second (default is 60). \
  29. This should equal the refresh rate of the display.")
  30. .takes_value(true))
  31. .arg(Arg::with_name("offline")
  32. .long("offline")
  33. .help("Do not use the network. \
  34. Try to load tiles from the offline file system cache."))
  35. .arg(Arg::with_name("sync")
  36. .long("sync")
  37. .help("Load tiles in a synchronous fashion. \
  38. The UI is blocked while tiles are loading."))
  39. .get_matches()
  40. }