MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / parse_optional_udid_text_args

Function parse_optional_udid_text_args

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

Source from the content-addressed store, hash-verified

3355}
3356
3357fn parse_optional_udid_text_args(
3358 command: &str,
3359 args: Vec<String>,
3360 has_non_positional_input: bool,
3361) -> anyhow::Result<(Option<String>, Option<String>)> {
3362 let args = clean_cli_args(args);
3363 if has_non_positional_input {
3364 return match args.as_slice() {
3365 [] => Ok((None, None)),
3366 [udid] => Ok((Some(udid.clone()), None)),
3367 _ => anyhow::bail!(
3368 "{command} accepts at most one positional UDID with --stdin or --file."
3369 ),
3370 };
3371 }
3372 match args.as_slice() {
3373 [] => Ok((None, None)),
3374 [text] => Ok((None, Some(text.clone()))),
3375 [udid, text] => Ok((Some(udid.clone()), Some(text.clone()))),
3376 _ => anyhow::bail!("{command} accepts either TEXT or UDID TEXT. Quote multi-word text."),
3377 }
3378}
3379
3380fn parse_optional_udid_f64_args(
3381 command: &str,

Calls 2

clean_cli_argsFunction · 0.85
cloneMethod · 0.65