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

Function run

rust/crates/ccusage/src/adapter/codebuff/mod.rs:14–34  ·  view source on GitHub ↗
(args: AgentCommandArgs)

Source from the content-addressed store, hash-verified

12pub(crate) use report::{report_from_rows, summarize_entries};
13
14pub(crate) fn run(args: AgentCommandArgs) -> Result<()> {
15 let shared = args.shared;
16 let pricing = PricingMap::load_with_overrides(
17 shared.offline,
18 crate::log_level() != Some(0),
19 shared.pricing_overrides.iter(),
20 );
21 let mut entries = load_entries(&shared, &pricing)?;
22 filter_loaded_entries_by_date(&mut entries, &shared);
23 let mut rows = summarize_entries(&entries, args.kind)?;
24 sort_summaries(&mut rows, &shared.order, report::summary_period);
25 if wants_json(&shared) {
26 return print_json_or_jq(
27 report_from_rows(&rows, args.kind),
28 shared.jq.as_deref(),
29 shared.no_cost,
30 );
31 }
32 crate::adapter::amp::print_table_for_agent("Codebuff", args.kind, &rows, &shared)?;
33 Ok(())
34}

Callers

nothing calls this directly

Calls 9

log_levelFunction · 0.85
sort_summariesFunction · 0.85
wants_jsonFunction · 0.85
print_json_or_jqFunction · 0.85
print_table_for_agentFunction · 0.85
load_entriesFunction · 0.70
summarize_entriesFunction · 0.70
report_from_rowsFunction · 0.70

Tested by

no test coverage detected