summaryrefslogtreecommitdiff
path: root/cli/args/flags_allow_net.rs
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-03-26 06:06:18 +0200
committerGitHub <noreply@github.com>2023-03-26 06:06:18 +0200
commit33362b88c3ef14c1ed36994f8740cb6e05c6e2fe (patch)
treeb60e11febd57047606c16a5b52bd26d7dc4ef06b /cli/args/flags_allow_net.rs
parent8a4865c3790a6eb93d95189e129b3ee98f349b45 (diff)
chore: upgrade clap to v4 (#17333)
Diffstat (limited to 'cli/args/flags_allow_net.rs')
-rw-r--r--cli/args/flags_allow_net.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/args/flags_allow_net.rs b/cli/args/flags_allow_net.rs
index 94699cc8b..9f8a6b9f9 100644
--- a/cli/args/flags_allow_net.rs
+++ b/cli/args/flags_allow_net.rs
@@ -26,12 +26,12 @@ impl FromStr for BarePort {
}
}
-pub fn validator(host_and_port: &str) -> Result<(), String> {
+pub fn validator(host_and_port: &str) -> Result<String, String> {
if Url::parse(&format!("internal://{host_and_port}")).is_ok()
|| host_and_port.parse::<IpAddr>().is_ok()
|| host_and_port.parse::<BarePort>().is_ok()
{
- Ok(())
+ Ok(host_and_port.to_string())
} else {
Err(format!("Bad host:port pair: {host_and_port}"))
}
@@ -40,7 +40,7 @@ pub fn validator(host_and_port: &str) -> Result<(), String> {
/// Expands "bare port" paths (eg. ":8080") into full paths with hosts. It
/// expands to such paths into 3 paths with following hosts: `0.0.0.0:port`,
/// `127.0.0.1:port` and `localhost:port`.
-pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> {
+pub fn parse(paths: Vec<String>) -> clap::error::Result<Vec<String>> {
let mut out: Vec<String> = vec![];
for host_and_port in paths.iter() {
if Url::parse(&format!("internal://{host_and_port}")).is_ok()
@@ -54,7 +54,7 @@ pub fn parse(paths: Vec<String>) -> clap::Result<Vec<String>> {
}
} else {
return Err(clap::Error::raw(
- clap::ErrorKind::InvalidValue,
+ clap::error::ErrorKind::InvalidValue,
format!("Bad host:port pair: {host_and_port}"),
));
}