Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. use clap; // 2.33.0
  2. use clap::{App, Arg, ArgMatches};
  3.  
  4. pub struct CLI {
  5. clap: App<'static,'static>,
  6. }
  7.  
  8. impl CLI {
  9.  
  10. pub fn new() -> CLI {
  11.  
  12. CLI{
  13. // you could do it here
  14. clap: App::new("My Super Program").arg(
  15. Arg::with_name("config")
  16. .short("c")
  17. .long("config")
  18. .value_name("FILE")
  19. .help("Sets a custom config file")
  20. .takes_value(true)
  21. ),
  22. }
  23.  
  24. }
  25.  
  26. pub fn setup(&mut self, line: String) -> () {
  27. // or here
  28. self.clap = App::new("My Super Program").arg(
  29. Arg::with_name("config")
  30. .short("c")
  31. .long("config")
  32. .value_name("FILE")
  33. .help("Sets a custom config file")
  34. .takes_value(true)
  35. );
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement