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

Function attached_value

atomic-cli/src/agent_error.rs:395–412  ·  view source on GitHub ↗
(value: &OsStr, spelling: &str)

Source from the content-addressed store, hash-verified

393}
394
395fn attached_value(value: &OsStr, spelling: &str) -> Option<OsString> {
396 let prefixes = if spelling.starts_with("--") {
397 vec![format!("{spelling}=")]
398 } else {
399 vec![format!("{spelling}="), spelling.to_string()]
400 };
401
402 for prefix in prefixes {
403 if let Some(value) = value.to_str() {
404 if let Some(suffix) = value.strip_prefix(&prefix) {
405 return Some(OsString::from(suffix));
406 }
407 } else if let Some(value) = attached_non_utf8_value(value, &prefix) {
408 return Some(value);
409 }
410 }
411 None
412}
413
414#[cfg(unix)]
415fn attached_non_utf8_value(value: &OsStr, prefix: &str) -> Option<OsString> {

Callers 1

raw_option_valueFunction · 0.85

Calls 1

attached_non_utf8_valueFunction · 0.85

Tested by

no test coverage detected