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,
)
| 2566 | /// Dispatches to `sandbox_sync_up` or `sandbox_sync_down` based on the |
| 2567 | /// `--up` / `--down` flags. |
| 2568 | pub 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 | /// |
nothing calls this directly
no test coverage detected