From: Erik Mackdanz Date: Wed, 27 Nov 2024 19:30:25 +0000 (-0600) Subject: default args X-Git-Url: https://git.humopery.space/?a=commitdiff_plain;h=a55f788781acae60a91e4011a03895a2ac95d80a;p=vecsearch.git default args --- diff --git a/src/main.rs b/src/main.rs index 9bc9364..32f2a1e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,16 +14,16 @@ enum Action { /// Initialize the database when the table doesn't exist already InitDatabase { - #[arg(long)] + #[arg(long,default_value="vsearch")] dbname: String, - #[arg(long)] + #[arg(long,default_value="localhost")] host: String, - #[arg(long)] + #[arg(long,default_value="cvmigrator")] user: String, - #[arg(long)] + #[arg(long,env)] password: String, }, @@ -144,11 +144,12 @@ fn main() -> Result<()> { match args.action { Action::InitDatabase{ dbname, host, user, password } => { + println!("maybe creating the database"); let mut client = postgres::Config::new() .dbname("postgres") - .host(&host.to_string()) - .user(&user.to_string()) + .host(&host) + .user(&user) .password(password.clone()) .connect(NoTls)?; @@ -166,8 +167,8 @@ fn main() -> Result<()> { println!("maybe creating database objects"); let mut client = postgres::Config::new() .dbname(&dbname) - .host(&host.to_string()) - .user(&user.to_string()) + .host(&host) + .user(&user) .password(password) .connect(NoTls)?;