Updated CLI Set URL (#6)

* Updated CLI Set URL

imu set --url now will default to https:// if nothing is provided

* fixed an oops

* requested change
This commit is contained in:
Skywalker8510 2025-03-10 18:22:43 -05:00 committed by GitHub
parent 710552fc1f
commit 4c4698ed8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,7 +53,7 @@ enum Commands {
/// Set the password for a server which requires login /// Set the password for a server which requires login
#[arg(short, long, required = false)] #[arg(short, long, required = false)]
password: Option<String>, password: Option<String>,
/// Set the URL of the server to connect to /// Set the URL of the server to connect to (assumes https://)
#[arg(long, required = false)] #[arg(long, required = false)]
url: Option<String>, url: Option<String>,
/// Set the directory to download into by default /// Set the directory to download into by default
@ -305,7 +305,12 @@ async fn main() -> Result<()> {
url url
}; };
config.url = url.to_string(); if !url.starts_with("https://") && !url.starts_with("http://") {
config.url = ("https://".to_owned() + url).to_string();
} else {
config.url = url.to_string();
}
config.save().unwrap(); config.save().unwrap();
println!("URL set to \"{url}\""); println!("URL set to \"{url}\"");
} }