From 625ec3640e9b558bc4d1b9c078f9348bea616feb Mon Sep 17 00:00:00 2001 From: Skywalker8510 <91810623+Skywalker8510@users.noreply.github.com> Date: Mon, 10 Mar 2025 17:55:26 -0500 Subject: [PATCH] Updated CLI Set URL imu set --url now will default to https:// if nothing is provided --- confetti-cli/Cargo.toml | 2 +- confetti-cli/src/main.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/confetti-cli/Cargo.toml b/confetti-cli/Cargo.toml index 092c9be..0fc6485 100644 --- a/confetti-cli/Cargo.toml +++ b/confetti-cli/Cargo.toml @@ -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"] diff --git a/confetti-cli/src/main.rs b/confetti-cli/src/main.rs index 4471c71..d077915 100644 --- a/confetti-cli/src/main.rs +++ b/confetti-cli/src/main.rs @@ -53,7 +53,7 @@ enum Commands { /// Set the password for a server which requires login #[arg(short, long, required = false)] password: Option, - /// 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, /// 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}\""); }