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

url trim slashes

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