Execute the clone command. This method creates a tokio runtime and executes the async clone operation. It handles all the steps required to create a local copy of a remote repository. # Errors Returns an error if: - The target directory already exists - The remote cannot be connected to - Network operations fail - Changes fail to download or save
(&self)
| 618 | /// - Network operations fail |
| 619 | /// - Changes fail to download or save |
| 620 | fn run(&self) -> CliResult<()> { |
| 621 | // Validate URL is not empty |
| 622 | if self.url.is_empty() { |
| 623 | return Err(CliError::InvalidArgument { |
| 624 | message: "Repository URL is required".to_string(), |
| 625 | }); |
| 626 | } |
| 627 | |
| 628 | // Create a runtime for async operations |
| 629 | let rt = tokio::runtime::Runtime::new().map_err(|e| { |
| 630 | CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e)) |
| 631 | })?; |
| 632 | |
| 633 | rt.block_on(self.run_async()) |
| 634 | } |
| 635 | } |
| 636 | |
| 637 | // Tests |