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

Method set_url

atomic-repository/src/remote.rs:544–564  ·  view source on GitHub ↗

Update the URL of an existing remote. # Arguments `name` - The name of the remote to update `url` - The new URL # Errors Returns an error if the remote doesn't exist or the URL is invalid.

(&mut self, name: &str, url: impl Into<String>)

Source from the content-addressed store, hash-verified

542 ///
543 /// Returns an error if the remote doesn't exist or the URL is invalid.
544 pub fn set_url(&mut self, name: &str, url: impl Into<String>) -> RemoteResult<()> {
545 let url = url.into();
546
547 // Validate URL
548 if !url.contains("://") {
549 return Err(RemoteError::InvalidUrl {
550 url,
551 reason: "URL must include a scheme (e.g., https://)".to_string(),
552 });
553 }
554
555 let entry = self
556 .remotes
557 .get_mut(name)
558 .ok_or_else(|| RemoteError::NotFound {
559 name: name.to_string(),
560 })?;
561
562 entry.url = url;
563 Ok(())
564 }
565
566 /// Set a remote as the default.
567 ///

Callers 2

set_remote_urlMethod · 0.45

Calls 2

get_mutMethod · 0.80
containsMethod · 0.45

Tested by 1