MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / sandbox_sync_command

Function sandbox_sync_command

crates/openshell-cli/src/run.rs:2568–2603  ·  view source on GitHub ↗

Sync files to or from a sandbox. Dispatches to `sandbox_sync_up` or `sandbox_sync_down` based on the `--up` / `--down` flags.

(
    server: &str,
    name: &str,
    up: Option<&str>,
    down: Option<&str>,
    dest: Option<&str>,
    tls: &TlsOptions,
)

Source from the content-addressed store, hash-verified

2566/// Dispatches to `sandbox_sync_up` or `sandbox_sync_down` based on the
2567/// `--up` / `--down` flags.
2568pub async fn sandbox_sync_command(
2569 server: &str,
2570 name: &str,
2571 up: Option<&str>,
2572 down: Option<&str>,
2573 dest: Option<&str>,
2574 tls: &TlsOptions,
2575) -> Result<()> {
2576 match (up, down) {
2577 (Some(local_path), None) => {
2578 let local = Path::new(local_path);
2579 if !local.exists() {
2580 return Err(miette::miette!(
2581 "local path does not exist: {}",
2582 local.display()
2583 ));
2584 }
2585 let dest_display = dest.unwrap_or("~");
2586 eprintln!("Syncing {} -> sandbox:{}", local.display(), dest_display);
2587 sandbox_sync_up(server, name, local, dest, tls).await?;
2588 eprintln!("{} Sync complete", "✓".green().bold());
2589 }
2590 (None, Some(sandbox_path)) => {
2591 let local_dest = dest.unwrap_or(".");
2592 eprintln!("Syncing sandbox:{sandbox_path} -> {local_dest}");
2593 sandbox_sync_down(server, name, sandbox_path, local_dest, tls).await?;
2594 eprintln!("{} Sync complete", "✓".green().bold());
2595 }
2596 _ => {
2597 return Err(miette::miette!(
2598 "specify either --up <local-path> or --down <sandbox-path>"
2599 ));
2600 }
2601 }
2602 Ok(())
2603}
2604
2605/// Fetch a sandbox by name.
2606///

Callers

nothing calls this directly

Calls 3

sandbox_sync_upFunction · 0.85
sandbox_sync_downFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected