Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples: fix overwritten mode in config file (fix #700) #702

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ pub struct CommonArgs {
#[arg(short, long)]
/// A configuration file.
config: Option<String>,
#[arg(short, long, default_value = "peer")]
/// The Zenoh session mode.
mode: Wai,
#[arg(short, long)]
/// The Zenoh session mode [default: peer].
mode: Option<Wai>,
#[arg(short = 'e', long)]
/// Endpoints to connect to.
connect: Vec<String>,
Expand All @@ -48,10 +48,12 @@ impl From<&CommonArgs> for Config {
Some(path) => Config::from_file(path).unwrap(),
None => Config::default(),
};
println!("ARGS mode: {:?} ", value.mode);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed since now it's printed in very examples, including throughput and latency tests.

match value.mode {
Wai::Peer => config.set_mode(Some(zenoh::scouting::WhatAmI::Peer)),
Wai::Client => config.set_mode(Some(zenoh::scouting::WhatAmI::Client)),
Wai::Router => config.set_mode(Some(zenoh::scouting::WhatAmI::Router)),
Some(Wai::Peer) => config.set_mode(Some(zenoh::scouting::WhatAmI::Peer)),
Some(Wai::Client) => config.set_mode(Some(zenoh::scouting::WhatAmI::Client)),
Some(Wai::Router) => config.set_mode(Some(zenoh::scouting::WhatAmI::Router)),
None => Ok(None),
}
.unwrap();
if !value.connect.is_empty() {
Expand Down