Skip to content

Commit

Permalink
Bug 1751342 - Upgrade geckodriver to clap 3. r=webdriver-reviewers,jg…
Browse files Browse the repository at this point in the history
…raham

Differential Revision: https://phabricator.services.mozilla.com/D136569
  • Loading branch information
glandium committed Jan 21, 2022
1 parent 5af577e commit 59ce12b
Show file tree
Hide file tree
Showing 224 changed files with 37,574 additions and 26,248 deletions.
48 changes: 29 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testing/geckodriver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
base64 = "0.12"
chrono = "0.4.6"
clap = { version = "^2.19", default-features = false, features = ["suggestions", "wrap_help"] }
clap = { version = "3", default-features = false, features = ["cargo", "std", "suggestions", "wrap_help"] }
hyper = "0.13"
lazy_static = "1.0"
log = { version = "0.4", features = ["std"] }
Expand Down
52 changes: 26 additions & 26 deletions testing/geckodriver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ fn get_allowed_origins(allow_origins: Option<clap::Values>) -> Result<Vec<Url>,
}

fn parse_args(app: &mut App) -> ProgramResult<Operation> {
let args = app.get_matches_from_safe_borrow(env::args())?;
let args = app.try_get_matches_from_mut(env::args())?;

if args.is_present("help") {
return Ok(Operation::Help);
Expand Down Expand Up @@ -261,7 +261,7 @@ fn parse_args(app: &mut App) -> ProgramResult<Operation> {
};

let android_storage =
value_t!(args, "android_storage", AndroidStorageInput).unwrap_or(AndroidStorageInput::Auto);
args.value_of_t::<AndroidStorageInput>("android_storage").unwrap_or(AndroidStorageInput::Auto);

let binary = args.value_of("binary").map(PathBuf::from);

Expand Down Expand Up @@ -378,115 +378,115 @@ fn main() {
});
}

fn make_app<'a, 'b>() -> App<'a, 'b> {
fn make_app<'a>() -> App<'a> {
App::new(format!("geckodriver {}", build::build_info()))
.about("WebDriver implementation for Firefox")
.arg(
Arg::with_name("webdriver_host")
Arg::new("webdriver_host")
.long("host")
.takes_value(true)
.value_name("HOST")
.default_value("127.0.0.1")
.help("Host IP to use for WebDriver server"),
)
.arg(
Arg::with_name("webdriver_port")
.short("p")
Arg::new("webdriver_port")
.short('p')
.long("port")
.takes_value(true)
.value_name("PORT")
.default_value("4444")
.help("Port to use for WebDriver server"),
)
.arg(
Arg::with_name("binary")
.short("b")
Arg::new("binary")
.short('b')
.long("binary")
.takes_value(true)
.value_name("BINARY")
.help("Path to the Firefox binary"),
)
.arg(
Arg::with_name("marionette_host")
Arg::new("marionette_host")
.long("marionette-host")
.takes_value(true)
.value_name("HOST")
.default_value("127.0.0.1")
.help("Host to use to connect to Gecko"),
)
.arg(
Arg::with_name("marionette_port")
Arg::new("marionette_port")
.long("marionette-port")
.takes_value(true)
.value_name("PORT")
.help("Port to use to connect to Gecko [default: system-allocated port]"),
)
.arg(
Arg::with_name("websocket_port")
Arg::new("websocket_port")
.long("websocket-port")
.takes_value(true)
.value_name("PORT")
.conflicts_with("connect_existing")
.help("Port to use to connect to WebDriver BiDi [default: 9222]"),
)
.arg(
Arg::with_name("connect_existing")
Arg::new("connect_existing")
.long("connect-existing")
.requires("marionette_port")
.help("Connect to an existing Firefox instance"),
)
.arg(
Arg::with_name("jsdebugger")
Arg::new("jsdebugger")
.long("jsdebugger")
.help("Attach browser toolbox debugger for Firefox"),
)
.arg(
Arg::with_name("verbosity")
.multiple(true)
Arg::new("verbosity")
.multiple_occurrences(true)
.conflicts_with("log_level")
.short("v")
.short('v')
.help("Log level verbosity (-v for debug and -vv for trace level)"),
)
.arg(
Arg::with_name("log_level")
Arg::new("log_level")
.long("log")
.takes_value(true)
.value_name("LEVEL")
.possible_values(&["fatal", "error", "warn", "info", "config", "debug", "trace"])
.help("Set Gecko log level"),
)
.arg(
Arg::with_name("help")
.short("h")
Arg::new("help")
.short('h')
.long("help")
.help("Prints this message"),
)
.arg(
Arg::with_name("version")
.short("V")
Arg::new("version")
.short('V')
.long("version")
.help("Prints version and copying information"),
)
.arg(
Arg::with_name("android_storage")
Arg::new("android_storage")
.long("android-storage")
.possible_values(&["auto", "app", "internal", "sdcard"])
.value_name("ANDROID_STORAGE")
.help("Selects storage location to be used for test data (deprecated)."),
)
.arg(
Arg::with_name("allow_hosts")
Arg::new("allow_hosts")
.long("allow-hosts")
.takes_value(true)
.multiple(true)
.multiple_values(true)
.value_name("ALLOW_HOSTS")
.help("List of hostnames to allow. By default the value of --host is allowed, and in addition if that's a well known local address, other variations on well known local addresses are allowed. If --allow-hosts is provided only exactly those hosts are allowed."),
)
.arg(
Arg::with_name("allow_origins")
Arg::new("allow_origins")
.long("allow-origins")
.takes_value(true)
.multiple(true)
.multiple_values(true)
.value_name("ALLOW_ORIGINS")
.help("List of request origins to allow. These must be formatted as scheme://host:port. By default any request with an origin header is rejected. If --allow-origins is provided then only exactly those origins are allowed."),
)
Expand Down
Loading

0 comments on commit 59ce12b

Please sign in to comment.