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)
| 1136 | /// - Network operations fail |
| 1137 | /// - Changes fail to download or save |
| 1138 | fn run(&self) -> CliResult<()> { |
| 1139 | // Validate URL is not empty |
| 1140 | if self.url.is_empty() { |
| 1141 | return Err(CliError::InvalidArgument { |
| 1142 | message: "Repository URL is required".to_string(), |
| 1143 | }); |
| 1144 | } |
| 1145 | |
| 1146 | // Create a runtime for async operations |
| 1147 | let rt = tokio::runtime::Runtime::new().map_err(|e| { |
| 1148 | CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e)) |
| 1149 | })?; |
| 1150 | |
| 1151 | rt.block_on(self.run_async()) |
| 1152 | } |
| 1153 | } |
| 1154 | |
| 1155 | // Tests |