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:
- Determining the destination directory
- Validating the destination
- Removing existing destination if –force is set
- Cloning the repository with progress
- Detecting and validating workspace configuration (Story 11.3)
- Initializing workspace if needed (Story 11.4)
§Arguments
args- Clone command arguments containing URL, destination, and optionsoutput- Output handler for consistent formatting across all commandsroot- Root directory for the workspaceconfig_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?;