MCPcopy Create free account
hub / github.com/ccusage/ccusage / value_for

Method value_for

rust/crates/ccusage-cli/src/arg_parser.rs:54–68  ·  view source on GitHub ↗
(&mut self, flag: &str)

Source from the content-addressed store, hash-verified

52 }
53
54 pub(crate) fn value_for(&mut self, flag: &str) -> Result<String, String> {
55 if let Some(value) = self.pending_value.take() {
56 if value.is_empty() {
57 return Err(format!("Missing value for {flag}"));
58 }
59 return Ok(value);
60 }
61 let value = self
62 .next()
63 .ok_or_else(|| format!("Missing value for {flag}"))?;
64 if value.starts_with('-') {
65 return Err(format!("Missing value for {flag}"));
66 }
67 Ok(value)
68 }
69}
70
71#[cfg(test)]

Callers 9

parse_commandFunction · 0.80
parse_codex_commandFunction · 0.80
parse_pi_commandFunction · 0.80
parse_openclaw_commandFunction · 0.80
parse_shared_argFunction · 0.80

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected