Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use clap; // 2.33.0
- use clap::{App, Arg, ArgMatches};
- pub struct CLI {
- clap: App<'static,'static>,
- }
- impl CLI {
- pub fn new() -> CLI {
- CLI{
- // you could do it here
- clap: App::new("My Super Program").arg(
- Arg::with_name("config")
- .short("c")
- .long("config")
- .value_name("FILE")
- .help("Sets a custom config file")
- .takes_value(true)
- ),
- }
- }
- pub fn setup(&mut self, line: String) -> () {
- // or here
- self.clap.arg(
- Arg::with_name("config")
- .short("c")
- .long("config")
- .value_name("FILE")
- .help("Sets a custom config file")
- .takes_value(true)
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement