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)
| 915 | /// - Network operations fail |
| 916 | /// - Changes fail to download or save |
| 917 | fn run(&self) -> CliResult<()> { |
| 918 | // Validate URL is not empty |
| 919 | if self.url.is_empty() { |
| 920 | return Err(CliError::InvalidArgument { |
| 921 | message: "Repository URL is required".to_string(), |
| 922 | }); |
| 923 | } |
| 924 | |
| 925 | // Create a runtime for async operations |
| 926 | let rt = tokio::runtime::Runtime::new().map_err(|e| { |
| 927 | CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e)) |
| 928 | })?; |
| 929 | |
| 930 | rt.block_on(self.run_async()) |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | // Tests |