feat: generate config, load shell env vars

This commit is contained in:
2023-01-29 19:19:50 -05:00
parent 58b4b00311
commit 7c5c0c13fb
8 changed files with 275 additions and 56 deletions
+3 -13
View File
@@ -1,4 +1,4 @@
use std::collections::HashMap;
use std::{collections::HashMap, process};
use clap::ArgMatches;
use reqwest::blocking::Client;
@@ -56,17 +56,6 @@ impl<'a> Request<'a> {
authentication: auth,
}
}
/// public method that decides whether to format the request url
/// based on the authentication written in the config file.
/// Returns an integer.
pub fn url_request(&self) -> bool {
if self.authentication.api_token {
true
} else {
false
}
}
}
impl Authentication {
@@ -90,7 +79,8 @@ impl Authentication {
basic_auth,
)
} else {
panic!("Must have some form of authentication! Exiting...");
println!("Must have some form of authentication! Exiting...");
process::exit(3)
}
} else {
Authentication::with_api_token(config.username.as_ref().unwrap().to_string(), api_auth)