Remove auth CLI argument and use user + pass instead

This commit is contained in:
Tobie Morgan Hitchcock 2022-05-07 15:06:46 +01:00
parent 82140410d6
commit 0ff3d0f7d0

View file

@ -7,17 +7,6 @@ mod version;
use clap::{Arg, Command};
fn auth_valid(v: &str) -> Result<(), String> {
if v.contains(':') {
return Ok(());
}
Err(String::from(
"\
Provide a valid user:pass value separated by a colon, \
or use the --auth-user and --auth-pass flags\
",
))
}
fn file_valid(v: &str) -> Result<(), String> {
if !v.is_empty() {
@ -138,33 +127,24 @@ pub fn init() {
.help("Database path used for storing data"),
)
.arg(
Arg::new("auth")
.short('a')
.long("auth")
.forbid_empty_values(true)
.validator(auth_valid)
.default_value("root:root")
.help("Master database authentication details"),
)
.arg(
Arg::new("auth-user")
Arg::new("user")
.short('u')
.long("auth-user")
.long("user")
.forbid_empty_values(true)
.default_value("root")
.help("The master username for the database"),
)
.arg(
Arg::new("auth-pass")
Arg::new("pass")
.short('p')
.long("auth-pass")
.long("pass")
.forbid_empty_values(true)
.default_value("root")
.help("The master password for the database"),
)
.arg(
Arg::new("auth-addr")
.long("auth-addr")
Arg::new("addr")
.long("addr")
.number_of_values(1)
.forbid_empty_values(true)
.multiple_occurrences(true)