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

Function resolve_target_path

atomic-cli/src/commands/clone/helpers.rs:195–203  ·  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

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

Calls 1

infer_repo_nameFunction · 0.70