1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
extern crate clap;

use clap::{App, Arg, ArgMatches, SubCommand};

pub fn get_matches<'a>() -> ArgMatches<'a> {
  App::new("dbui")
    .version("0.0.1")
    .author("Kyle Unverferth <dbui@kyleu.com>")
    .about("A work in progress")
    .arg(
      Arg::with_name("config")
        .short("c")
        .long("config")
        .value_name("DIRECTORY")
        .help("Sets a custom config directory (defaults to \".\")")
        .takes_value(true),
    )
    .arg(
      Arg::with_name("debug")
        .short("d")
        .help("Turn debugging information on"),
    )
    .subcommand(
      SubCommand::with_name("add")
        .about("Adds things to the configuration")
        .arg(Arg::with_name("list").short("l").help("lists test values")),
    )
    .get_matches()
}