Update a remote's URL.
(&self, set_url: &RemoteSetUrl)
| 227 | |
| 228 | /// Update a remote's URL. |
| 229 | fn set_url(&self, set_url: &RemoteSetUrl) -> CliResult<()> { |
| 230 | let repo_root = find_repository_root()?; |
| 231 | let repo = Repository::open(&repo_root).map_err(CliError::Repository)?; |
| 232 | |
| 233 | // Check if URL is valid |
| 234 | if !set_url.url.contains("://") { |
| 235 | return Err(CliError::InvalidArgument { |
| 236 | message: format!( |
| 237 | "Invalid URL '{}': URL must include a scheme (e.g., https://)", |
| 238 | set_url.url |
| 239 | ), |
| 240 | }); |
| 241 | } |
| 242 | |
| 243 | repo.set_remote_url(&set_url.name, &set_url.url) |
| 244 | .map_err(CliError::Repository)?; |
| 245 | |
| 246 | print_success(&format!("Remote '{}' URL updated", set_url.name)); |
| 247 | if self.verbose { |
| 248 | println!(" New URL: {}", set_url.url); |
| 249 | } |
| 250 | |
| 251 | Ok(()) |
| 252 | } |
| 253 | |
| 254 | /// Rename a remote. |
| 255 | fn rename_remote(&self, rename: &RemoteRename) -> CliResult<()> { |
no test coverage detected