Updated CLI Set URL

imu set --url now will default to https:// if nothing is provided
This commit is contained in:
Skywalker8510 2025-03-10 17:55:26 -05:00
parent 710552fc1f
commit 625ec3640e
2 changed files with 8 additions and 3 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "confetti_cli"
version = "0.1.1"
version = "0.1.2"
description = "A simple command line interface to interact with a Confetti-Box instance."
repository = "https://github.com/Dangoware/confetti-box"
keywords = ["selfhost", "upload", "command_line"]

View file

@ -53,7 +53,7 @@ enum Commands {
/// Set the password for a server which requires login
#[arg(short, long, required = false)]
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)]
url: Option<String>,
/// Set the directory to download into by default
@ -305,7 +305,12 @@ async fn main() -> Result<()> {
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();
println!("URL set to \"{url}\"");
}