summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-11-10 08:31:24 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-11-10 08:31:33 +0100
commit596e863e92bd606458a76c3d2a5fb0da83b20dda (patch)
treef95b40c2e058443d27ac0777500e214451248eda /src/cli.rs
parent451b417f547c9c58a66847bf472e82664c87460b (diff)
Move DB cli interface to proper place
This moves the DB CLI interface building code to src/cli.rs and the interface handling code to src/commands/db.rs Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs56
1 files changed, 55 insertions, 1 deletions
diff --git a/src/cli.rs b/src/cli.rs
index d1163b4..6aefbd4 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -60,8 +60,62 @@ pub fn cli<'a>() -> App<'a> {
.help("Overwrite the database name set via configuration. Can also be overriden via environment, but this setting has presendence.")
)
+ .subcommand(App::new("db")
+ .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
- .subcommand(crate::db::cli())
+ 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")
+ .arg(Arg::with_name("csv")
+ .required(false)
+ .multiple(false)
+ .long("csv")
+ .takes_value(false)
+ .help("Format output as CSV")
+ )
+ )
+
+ .subcommand(App::new("envvars")
+ .about("List envvars from the DB")
+ .arg(Arg::with_name("csv")
+ .required(false)
+ .multiple(false)
+ .long("csv")
+ .takes_value(false)
+ .help("Format output as CSV")
+ )
+ )
+
+ .subcommand(App::new("images")
+ .about("List images from the DB")
+ .arg(Arg::with_name("csv")
+ .required(false)
+ .multiple(false)
+ .long("csv")
+ .takes_value(false)
+ .help("Format output as CSV")
+ )
+ )
+ )
.subcommand(App::new("build")
.about("Build packages in containers")