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

Add --webdriver-port argument back as a hidden alias #235

Merged
merged 1 commit into from
Sep 21, 2016
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this program is documented in this file.
- The `binary`, `args`, and `profile` entries on this dictionary is equivalent to the old `firefox_binary`, `firefox_args`, and `firefox_profile` capabilities, which have now all been removed
- The `log` capability takes a dictionary such as `{log: "trace"}` to enable trace level verbosity in Gecko
- The `prefs` capability lets you define Firefox preferences through capabilities
- Re-introduced the `--webdriver-port` argument as a hidden alias to `--port`

### Changed
- `firefox_binary`, `firefox_args`, and `firefox_profile` capabilities removed in favour of the `firefoxOptions` dictionary detailed above and in the README
Expand Down
11 changes: 9 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ fn app<'a, 'b>() -> App<'a, 'b> {
.value_name("HOST")
.help("Host ip to use for WebDriver server (default: 127.0.0.1)")
.takes_value(true))
.arg(Arg::with_name("webdriver_port_alias")
.long("--webdriver-port")
.takes_value(true)
.hidden(true))
.arg(Arg::with_name("webdriver_port")
.short("p")
.long("port")
.value_name("PORT")
.help("Port to use for WebDriver server (default: 4444)")
.takes_value(true))
.takes_value(true)
.conflicts_with("webdriver_port_alias"))
.arg(Arg::with_name("binary")
.short("b")
.long("binary")
Expand Down Expand Up @@ -141,7 +146,9 @@ You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.");
}

let host = matches.value_of("webdriver_host").unwrap_or("127.0.0.1");
let port = match u16::from_str(matches.value_of("webdriver_port").unwrap_or("4444")) {
let port = match u16::from_str(matches.value_of("webdriver_port")
.or(matches.value_of("webdriver_port_alias"))
.unwrap_or("4444")) {
Ok(x) => x,
Err(_) => return Err((ExitCode::Usage, "invalid WebDriver port".to_owned())),
};
Expand Down