summaryrefslogtreecommitdiffstats
path: root/src/db/cli.rs
blob: 445df3e46f34a07384676b9e6490b5c41fe44015 (plain)
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
30
31
32
33
34
35
36
37
38
39
use clap_v3 as clap;
use clap::App;
use clap::Arg;
use clap::crate_authors;
use clap::crate_version;

pub fn cli<'a>() -> App<'a> {
    App::new("db")
        .author(crate_authors!())
        .version(crate_version!())
        .about("Database CLI interface")

        .subcommand(App::new("cli")
            .about("Start a database CLI, if installed on the current host")
            .long_about(indoc::indoc!(r#"
                Starts a database shell on the configured database using one of the following
                programs:
                    - psql
                    - pgcli

                if installed.
            "#))

            .arg(Arg::with_name("tool")
                .required(false)
                .multiple(false)
                .long("tool")
                .value_name("TOOL")
                .possible_values(&["psql", "pgcli"])
                .help("Use a specific tool")
            )
        )

        .subcommand(App::new("artifacts")
            .about("List artifacts from the DB")
        )

}