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

Function run_provider_command

packages/server/src/main.rs:3483–3552  ·  view source on GitHub ↗
(command: ProviderCommand)

Source from the content-addressed store, hash-verified

3481}
3482
3483fn run_provider_command(command: ProviderCommand) -> anyhow::Result<()> {
3484 let script = studio_host_provider_script()?;
3485 let executable = env::current_exe().context("resolve simdeck executable")?;
3486 let mut args = Vec::new();
3487 match command {
3488 ProviderCommand::Connect {
3489 studio_url,
3490 host_id,
3491 host_token,
3492 config,
3493 work_root,
3494 } => {
3495 args.push("connect".to_owned());
3496 push_arg(&mut args, "--studio-url", studio_url);
3497 push_arg(&mut args, "--host-id", host_id);
3498 push_arg(&mut args, "--host-token", host_token);
3499 push_optional_path_arg(&mut args, "--config", config);
3500 push_optional_path_arg(&mut args, "--work-root", work_root);
3501 }
3502 ProviderCommand::Run {
3503 config,
3504 studio_url,
3505 host_id,
3506 host_token,
3507 work_root,
3508 max_capacity,
3509 simulator_template,
3510 port,
3511 video_codec,
3512 stream_quality,
3513 } => {
3514 args.push("run".to_owned());
3515 push_optional_path_arg(&mut args, "--config", config);
3516 push_optional_arg(&mut args, "--studio-url", studio_url);
3517 push_optional_arg(&mut args, "--host-id", host_id);
3518 push_optional_arg(&mut args, "--host-token", host_token);
3519 push_optional_path_arg(&mut args, "--work-root", work_root);
3520 push_arg(&mut args, "--max-capacity", max_capacity.to_string());
3521 push_arg(&mut args, "--simulator-template", simulator_template);
3522 push_arg(&mut args, "--local-url", format!("http://127.0.0.1:{port}"));
3523 push_arg(
3524 &mut args,
3525 "--video-codec",
3526 video_codec.as_env_value().to_owned(),
3527 );
3528 push_arg(
3529 &mut args,
3530 "--stream-quality",
3531 stream_quality.as_profile_id().to_owned(),
3532 );
3533 }
3534 ProviderCommand::Status { config } => {
3535 args.push("status".to_owned());
3536 push_optional_path_arg(&mut args, "--config", config);
3537 }
3538 }
3539 let status = ProcessCommand::new("node")
3540 .arg(script)

Callers 1

mainFunction · 0.85

Calls 6

push_argFunction · 0.85
push_optional_path_argFunction · 0.85
push_optional_argFunction · 0.85
as_env_valueMethod · 0.80
as_profile_idMethod · 0.80

Tested by

no test coverage detected