Skip to content

Commit

Permalink
Merge pull request #635 from Jarsop/fix/cli-examples
Browse files Browse the repository at this point in the history
Fix cli examples
  • Loading branch information
kydos authored Dec 28, 2023
2 parents d8c27a6 + 234d694 commit 256b07e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion plugins/zenoh-plugin-rest/examples/z_serve_sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn parse_args() -> Config {
.arg(arg!(-l --listen [ENDPOINT]... "Endpoints to listen on."))
.arg(arg!(-c --config [FILE] "A configuration file."))
.arg(
arg!(--no-multicast-scouting "Disable the multicast-based scouting mechanism."
arg!(--"no-multicast-scouting" "Disable the multicast-based scouting mechanism."
),
)
.get_matches();
Expand Down
10 changes: 5 additions & 5 deletions zenoh-ext/examples/z_pub_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn parse_args() -> (Config, String, String, usize, Option<String>) {
)
.arg(arg!(-x --prefix [STRING] "An optional queryable prefix"))
.arg(arg!(-c --config [FILE] "A configuration file."))
.arg(arg!(--no-multicast-scouting "Disable the multicast-based scouting mechanism."))
.arg(arg!(--"no-multicast-scouting" "Disable the multicast-based scouting mechanism."))
.get_matches();

let mut config = if let Some(conf_file) = args.get_one::<&String>("config") {
Expand Down Expand Up @@ -97,10 +97,10 @@ fn parse_args() -> (Config, String, String, usize, Option<String>) {
.set_enabled(Some(ModeDependentValue::Unique(true)))
.unwrap();

let key_expr = args.get_one::<&String>("key").unwrap().to_string();
let value = args.get_one::<&String>("value").unwrap().to_string();
let history: usize = args.get_one::<&String>("history").unwrap().parse().unwrap();
let prefix = args.get_one::<&String>("prefix").map(|s| (*s).to_owned());
let key_expr = args.get_one::<String>("key").unwrap().to_string();
let value = args.get_one::<String>("value").unwrap().to_string();
let history: usize = args.get_one::<String>("history").unwrap().parse().unwrap();
let prefix = args.get_one::<String>("prefix").map(|s| (*s).to_owned());

(config, key_expr, value, history, prefix)
}
6 changes: 3 additions & 3 deletions zenoh-ext/examples/z_query_sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn parse_args() -> (Config, String, Option<String>) {
arg!(-q --query [SELECTOR] "The selector to use for queries (by default it's same than 'selector' option)")
)
.arg(arg!(-c --config [FILE] "A configuration file."))
.arg(arg!(--no-multicast-scouting "Disable the multicast-based scouting mechanism."))
.arg(arg!(--"no-multicast-scouting" "Disable the multicast-based scouting mechanism."))
.get_matches();

let mut config = if let Some(conf_file) = args.get_one::<&String>("config") {
Expand All @@ -120,8 +120,8 @@ fn parse_args() -> (Config, String, Option<String>) {
config.scouting.multicast.set_enabled(Some(false)).unwrap();
}

let key_expr = args.get_one::<&String>("key").unwrap().to_string();
let query = args.get_one::<&String>("query").map(ToString::to_string);
let key_expr = args.get_one::<String>("key").unwrap().to_string();
let query = args.get_one::<String>("query").map(ToString::to_string);

(config, key_expr, query)
}
8 changes: 4 additions & 4 deletions zenoh-ext/examples/z_view_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ fn parse_args() -> (Config, String, Option<String>, usize, u64) {
.extend(values.map(|v| v.parse().unwrap()))
}

let group = args.get_one::<&String>("group").unwrap().to_string();
let id = args.get_one::<&String>("id").map(|v| (*v).to_owned());
let size: usize = args.get_one::<&String>("size").unwrap().parse().unwrap();
let timeout: u64 = args.get_one::<&String>("timeout").unwrap().parse().unwrap();
let group = args.get_one::<String>("group").unwrap().to_string();
let id = args.get_one::<String>("id").map(|v| (*v).to_owned());
let size: usize = args.get_one::<String>("size").unwrap().parse().unwrap();
let timeout: u64 = args.get_one::<String>("timeout").unwrap().parse().unwrap();

(config, group, id, size, timeout)
}

0 comments on commit 256b07e

Please sign in to comment.