MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / set_url

Method set_url

atomic-cli/src/commands/remote/mod.rs:229–252  ·  view source on GitHub ↗

Update a remote's URL.

(&self, set_url: &RemoteSetUrl)

Source from the content-addressed store, hash-verified

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<()> {

Callers 1

runMethod · 0.45

Calls 4

find_repository_rootFunction · 0.85
print_successFunction · 0.85
set_remote_urlMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected