MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / parse_upload_spec

Function parse_upload_spec

crates/openshell-cli/src/main.rs:3170–3183  ·  view source on GitHub ↗

Parse an upload spec like ` [: ]` into (`local_path`, `optional_sandbox_path`).

(spec: &str)

Source from the content-addressed store, hash-verified

3168
3169/// Parse an upload spec like `<local>[:<remote>]` into (`local_path`, `optional_sandbox_path`).
3170fn parse_upload_spec(spec: &str) -> (String, Option<String>) {
3171 if let Some((local, remote)) = spec.split_once(':') {
3172 (
3173 local.to_string(),
3174 if remote.is_empty() {
3175 None
3176 } else {
3177 Some(remote.to_string())
3178 },
3179 )
3180 } else {
3181 (spec.to_string(), None)
3182 }
3183}
3184
3185#[cfg(test)]
3186mod tests {

Callers 4

mainFunction · 0.85

Calls 1

is_emptyMethod · 0.45