Skip to content

Commit

Permalink
fix port argument
Browse files Browse the repository at this point in the history
  • Loading branch information
p-avital committed Dec 6, 2021
1 parent 6dbecaa commit a98c2e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target
**/target
*~
*.log
.vscode
Expand Down
9 changes: 6 additions & 3 deletions zenoh-bridge-dds/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ fn parse_args() -> (Config, ArgMatches<'static>) {
This option disables this feature.'")
)
.arg(Arg::with_name("rest-port")
.long("port")
.long("rest-http-port")
.required(false)
.takes_value(true)
.value_name("PORT")
.help("Maps to `--cfg=/plugins/rest/port:PORT`. Disabled by default"))
.help("Maps to `--cfg=/plugins/rest/port:PORT`. Disabled by default."))
.args(&customize_dds_args(dds_args()));

let args = app.get_matches();
Expand All @@ -117,7 +117,10 @@ fn parse_args() -> (Config, ArgMatches<'static>) {
config.scouting.multicast.set_enabled(Some(false)).unwrap();
}
config.set_add_timestamp(Some(true)).unwrap();
if let Some(port) = args.value_of("rest-post") {
if let Some(port) = args
.value_of("rest-port")
.filter(|v| v.parse::<u16>().is_ok())
{
config.insert_json("plugins/rest/port", port).unwrap();
}

Expand Down

0 comments on commit a98c2e1

Please sign in to comment.