diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-11-03 17:12:11 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-11-03 17:46:51 +0100 |
commit | fa5b14fca13ca8b409677badd8d5a586a0885536 (patch) | |
tree | b8eeec98c220f931d6ca7ae965ed96e801fa97c7 /src/db | |
parent | 2dc17040af03eea496b055d851d27c403dfc73f4 (diff) |
Add DB CLI setup
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/cli.rs | 35 | ||||
-rw-r--r-- | src/db/mod.rs | 4 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/db/cli.rs b/src/db/cli.rs new file mode 100644 index 0000000..a762d4b --- /dev/null +++ b/src/db/cli.rs @@ -0,0 +1,35 @@ +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") + ) + ) + +} + diff --git a/src/db/mod.rs b/src/db/mod.rs index 0b0387e..95074cb 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -1,2 +1,6 @@ mod connection; pub use connection::*; + +mod cli; +pub use cli::*; + |