(
selector: &str,
explicit_server_url: Option<&str>,
)
| 3306 | } |
| 3307 | |
| 3308 | fn project_device_selection_for_selector( |
| 3309 | selector: &str, |
| 3310 | explicit_server_url: Option<&str>, |
| 3311 | ) -> anyhow::Result<ProjectDeviceSelection> { |
| 3312 | let selector = selector.trim(); |
| 3313 | if selector.is_empty() { |
| 3314 | anyhow::bail!("simdeck use requires a simulator UDID or name."); |
| 3315 | } |
| 3316 | |
| 3317 | let project_root = project_root()?; |
| 3318 | if android::is_android_id(selector) || looks_like_device_selector(selector) { |
| 3319 | return Ok(ProjectDeviceSelection { |
| 3320 | project_root, |
| 3321 | udid: selector.to_owned(), |
| 3322 | name: None, |
| 3323 | runtime_name: None, |
| 3324 | selected_at: now_secs(), |
| 3325 | }); |
| 3326 | } |
| 3327 | |
| 3328 | let server_url = command_service_url(explicit_server_url)?; |
| 3329 | let matched = select_studio_simulator(&server_url, selector)?; |
| 3330 | if let Some(simulator) = matched { |
| 3331 | return Ok(ProjectDeviceSelection { |
| 3332 | project_root, |
| 3333 | udid: simulator.udid, |
| 3334 | name: Some(simulator.name), |
| 3335 | runtime_name: simulator.runtime_name, |
| 3336 | selected_at: now_secs(), |
| 3337 | }); |
| 3338 | } |
| 3339 | |
| 3340 | anyhow::bail!("No simulator matched {selector:?}. Run `simdeck list` to see available UDIDs.") |
| 3341 | } |
| 3342 | |
| 3343 | fn parse_optional_udid_value_args( |
| 3344 | command: &str, |
no test coverage detected