From a55f788781acae60a91e4011a03895a2ac95d80a Mon Sep 17 00:00:00 2001 From: Erik Mackdanz Date: Wed, 27 Nov 2024 13:30:25 -0600 Subject: [PATCH] default args --- src/main.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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)?; -- 2.52.0