execute_clone

Function execute_clone 

Source
pub async fn execute_clone(
    args: &CloneArgs,
    output: &Output,
    root: &Path,
    config_path: Option<&Path>,
) -> Result<()>
Expand description

Executes the clone command.

This function orchestrates the complete clone workflow including:

  1. Determining the destination directory
  2. Validating the destination
  3. Removing existing destination if –force is set
  4. Cloning the repository with progress
  5. Detecting and validating workspace configuration (Story 11.3)
  6. Initializing workspace if needed (Story 11.4)

§Arguments

  • args - Clone command arguments containing URL, destination, and options
  • output - Output handler for consistent formatting across all commands
  • root - Root directory for the workspace
  • config_path - Optional path to configuration file

§Returns

Returns Ok(()) on successful clone and setup, or an error if any step fails.

§Errors

Returns an error if:

  • URL parsing fails
  • Destination validation fails
  • Clone operation fails (network, auth, disk space, etc.)
  • Workspace setup fails (Stories 11.3/11.4)

§Examples

use sublime_cli_tools::output::{Output, OutputFormat};
use std::io;

let args = CloneArgs {
    url: "https://github.com/org/repo.git".to_string(),
    destination: None,
    force: false,
    depth: None,
    // ... other fields
};

let output = Output::new(OutputFormat::Human, io::stdout(), false);
execute_clone(&args, &output, Path::new("."), None).await?;