A simple map viewer

args.rs 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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("pbf")
  21. .long("pbf")
  22. .value_name("FILE")
  23. .help("Set a *.osm.pbf file")
  24. .takes_value(true))
  25. .arg(Arg::with_name("search")
  26. .short("s")
  27. .long("search")
  28. .value_name("PATTERN")
  29. .help("Search for places which match the given pattern")
  30. .takes_value(true))
  31. .arg(Arg::with_name("fps")
  32. .long("fps")
  33. .value_name("FPS")
  34. .validator(|s| {
  35. s.parse::<f64>()
  36. .map(|_| ())
  37. .map_err(|e| format!("{}", e))
  38. })
  39. .help("Set target frames per second (default is 60). \
  40. This should equal the refresh rate of the display.")
  41. .takes_value(true))
  42. .arg(Arg::with_name("offline")
  43. .long("offline")
  44. .help("Do not use the network. \
  45. Try to load tiles from the offline file system cache."))
  46. .arg(Arg::with_name("sync")
  47. .long("sync")
  48. .help("Load tiles in a synchronous fashion. \
  49. The UI is blocked while tiles are loading."))
  50. .get_matches()
  51. }