]> Humopery - vecsearch.git/commitdiff
default args
authorErik Mackdanz <erikmack@gmail.com>
Wed, 27 Nov 2024 19:30:25 +0000 (13:30 -0600)
committerErik Mackdanz <erikmack@gmail.com>
Wed, 27 Nov 2024 19:30:25 +0000 (13:30 -0600)
src/main.rs

index 9bc93645e2e3bcbe415ba3ad497ec6ada3daef1f..32f2a1ef253a6891d69052abf94eb08d64bc9f73 100644 (file)
@@ -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)?;