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

Function resolve_target_path

atomic-cli/src/commands/clone/helpers.rs:194–202  ·  view source on GitHub ↗

Resolve the target path for cloning. If `path` is provided, uses that. Otherwise, infers from the URL. # Arguments `url` - The remote URL `path` - Optional explicit path # Returns The resolved target path. # Example ```rust use atomic::commands::clone::helpers::resolve_target_path; // Explicit path takes precedence let path = resolve_target_path("https://example.com/repo", Some("my-repo".t

(url: &str, path: Option<String>)

Source from the content-addressed store, hash-verified

192/// assert_eq!(path.to_str().unwrap(), "project");
193/// ```
194pub fn resolve_target_path(url: &str, path: Option<String>) -> PathBuf {
195 match path {
196 Some(p) => PathBuf::from(p),
197 None => {
198 let name = infer_repo_name(url).unwrap_or_else(|| "repo".to_string());
199 PathBuf::from(name)
200 }
201 }
202}
203
204// Cleanup Guard
205

Calls 1

infer_repo_nameFunction · 0.70