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)
| 706 | /// - Network operations fail |
| 707 | /// - Changes fail to download or save |
| 708 | fn run(&self) -> CliResult<()> { |
| 709 | // Validate URL is not empty |
| 710 | if self.url.is_empty() { |
| 711 | return Err(CliError::InvalidArgument { |
| 712 | message: "Repository URL is required".to_string(), |
| 713 | }); |
| 714 | } |
| 715 | |
| 716 | // Create a runtime for async operations |
| 717 | let rt = tokio::runtime::Runtime::new().map_err(|e| { |
| 718 | CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e)) |
| 719 | })?; |
| 720 | |
| 721 | rt.block_on(self.run_async()) |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | // Tests |