MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / parse_optional_udid_point_args

Function parse_optional_udid_point_args

packages/server/src/main.rs:3402–3422  ·  view source on GitHub ↗
(
    command: &str,
    args: Vec<String>,
)

Source from the content-addressed store, hash-verified

3400}
3401
3402fn parse_optional_udid_point_args(
3403 command: &str,
3404 args: Vec<String>,
3405) -> anyhow::Result<(Option<String>, Option<f64>, Option<f64>)> {
3406 let args = clean_cli_args(args);
3407 match args.as_slice() {
3408 [] => Ok((None, None, None)),
3409 [udid] => Ok((Some(udid.clone()), None, None)),
3410 [x, y] => Ok((
3411 None,
3412 Some(parse_required_f64_arg(command, x)?),
3413 Some(parse_required_f64_arg(command, y)?),
3414 )),
3415 [udid, x, y] => Ok((
3416 Some(udid.clone()),
3417 Some(parse_required_f64_arg(command, x)?),
3418 Some(parse_required_f64_arg(command, y)?),
3419 )),
3420 _ => anyhow::bail!("{command} accepts [UDID] or [UDID] CENTER_X CENTER_Y."),
3421 }
3422}
3423
3424fn parse_required_f64_arg(command: &str, value: &str) -> anyhow::Result<f64> {
3425 parse_f64_arg(value)

Callers 1

mainFunction · 0.85

Calls 3

clean_cli_argsFunction · 0.85
parse_required_f64_argFunction · 0.85
cloneMethod · 0.65

Tested by

no test coverage detected