MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / parse_host

Function parse_host

crates/openshell-cli/src/policy_update.rs:410–424  ·  view source on GitHub ↗
(flag: &str, spec: &str, host: &str)

Source from the content-addressed store, hash-verified

408}
409
410fn parse_host(flag: &str, spec: &str, host: &str) -> Result<String> {
411 let host = host.trim();
412 if host.is_empty() {
413 return Err(miette!("{flag} has an empty host segment in '{spec}'"));
414 }
415 if host.contains(char::is_whitespace) {
416 return Err(miette!(
417 "{flag} host must not contain whitespace in '{spec}'"
418 ));
419 }
420 if host.contains('/') {
421 return Err(miette!("{flag} host must not contain '/' in '{spec}'"));
422 }
423 Ok(host.to_string())
424}
425
426fn parse_port(flag: &str, spec: &str, port: &str) -> Result<u32> {
427 let port = port.trim();

Callers 3

parse_l7_rule_specFunction · 0.70
parse_add_endpoint_specFunction · 0.70

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected