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

Function parse_agent_report_kind

rust/crates/ccusage-cli/src/parser.rs:534–550  ·  view source on GitHub ↗
(
    parser: &mut ArgParser,
    agent: &str,
    reports: &[(&str, AgentReportKind)],
)

Source from the content-addressed store, hash-verified

532}
533
534fn parse_agent_report_kind(
535 parser: &mut ArgParser,
536 agent: &str,
537 reports: &[(&str, AgentReportKind)],
538) -> Result<AgentReportKind, String> {
539 let Some(command) = parser.peek() else {
540 return Ok(AgentReportKind::Daily);
541 };
542 if let Some((_, kind)) = reports.iter().find(|(report, _)| *report == command) {
543 parser.next();
544 return Ok(*kind);
545 }
546 if !command.starts_with('-') {
547 return Err(format!("Unknown {agent} command '{command}'"));
548 }
549 Ok(AgentReportKind::Daily)
550}
551
552fn agent_command_args(shared: SharedArgs, kind: AgentReportKind) -> AgentCommandArgs {
553 AgentCommandArgs {

Callers 4

parse_codex_commandFunction · 0.85
parse_pi_commandFunction · 0.85
parse_openclaw_commandFunction · 0.85

Calls 3

peekMethod · 0.80
findMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected