Remove auth CLI argument and use user + pass instead
This commit is contained in:
parent
82140410d6
commit
0ff3d0f7d0
1 changed files with 6 additions and 26 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue