提交 45c2e58f authored 作者: Serhij S's avatar Serhij S

url trim slashes

上级 27f2d752
...@@ -1030,7 +1030,7 @@ dependencies = [ ...@@ -1030,7 +1030,7 @@ dependencies = [
[[package]] [[package]]
name = "roboplc-cli" name = "roboplc-cli"
version = "0.1.5" version = "0.1.7"
dependencies = [ dependencies = [
"clap", "clap",
"colored", "colored",
......
[package] [package]
name = "roboplc-cli" name = "roboplc-cli"
version = "0.1.6" version = "0.1.7"
edition = "2021" edition = "2021"
authors = ["Serhij S. <div@altertech.com>"] authors = ["Serhij S. <div@altertech.com>"]
license = "Apache-2.0" license = "Apache-2.0"
......
...@@ -362,7 +362,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ...@@ -362,7 +362,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
robo_toml.replace(value); robo_toml.replace(value);
} }
let timeout = timeout.unwrap_or(DEFAULT_TIMEOUT); let timeout = timeout.unwrap_or(DEFAULT_TIMEOUT);
let url = url.ok_or("URL not specified")?; let url_s = url.ok_or("URL not specified")?;
let url = url_s.trim_end_matches('/');
let key = key.ok_or("Key not specified")?; let key = key.ok_or("Key not specified")?;
let agent: Agent = ureq::AgentBuilder::new() let agent: Agent = ureq::AgentBuilder::new()
.timeout_read(Duration::from_secs(timeout)) .timeout_read(Duration::from_secs(timeout))
...@@ -370,19 +371,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ...@@ -370,19 +371,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.build(); .build();
match args.subcmd { match args.subcmd {
SubCommand::Stat => { SubCommand::Stat => {
stat_command(&url, &key, agent)?; stat_command(url, &key, agent)?;
} }
SubCommand::Config => { SubCommand::Config => {
set_mode_command(&url, &key, agent, Mode::Config)?; set_mode_command(url, &key, agent, Mode::Config)?;
} }
SubCommand::Run => { SubCommand::Run => {
set_mode_command(&url, &key, agent, Mode::Run)?; set_mode_command(url, &key, agent, Mode::Run)?;
} }
SubCommand::Flash(opts) => { SubCommand::Flash(opts) => {
flash(&url, &key, agent, opts, robo_toml)?; flash(url, &key, agent, opts, robo_toml)?;
} }
SubCommand::Purge => { SubCommand::Purge => {
purge_command(&url, &key, agent)?; purge_command(url, &key, agent)?;
} }
} }
Ok(()) Ok(())
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论