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

Function run

rust/crates/ccusage/src/adapter/droid/mod.rs:15–46  ·  view source on GitHub ↗
(args: AgentCommandArgs)

Source from the content-addressed store, hash-verified

13pub(crate) use report::{report_from_rows, summarize_entries};
14
15pub(crate) fn run(args: AgentCommandArgs) -> Result<()> {
16 let shared = args.shared;
17 let pricing = PricingMap::load_with_overrides(
18 shared.offline,
19 crate::log_level() != Some(0),
20 shared.pricing_overrides.iter(),
21 );
22 let mut entries = load_entries(&shared, &pricing)?;
23 filter_loaded_entries_by_date(&mut entries, &shared);
24 let mut rows = summarize_entries(&entries, args.kind)?;
25 sort_summaries(
26 &mut rows,
27 &shared.order,
28 crate::adapter::opencode::summary_period,
29 );
30 if wants_json(&shared) {
31 return print_json_or_jq(
32 report_from_rows(&rows, args.kind),
33 shared.jq.as_deref(),
34 shared.no_cost,
35 );
36 }
37 print_usage_table(
38 "Droid Token Usage Report",
39 crate::adapter::opencode::first_column(args.kind),
40 &rows,
41 &shared,
42 false,
43 None,
44 )?;
45 Ok(())
46}

Callers

nothing calls this directly

Calls 10

log_levelFunction · 0.85
sort_summariesFunction · 0.85
wants_jsonFunction · 0.85
print_json_or_jqFunction · 0.85
print_usage_tableFunction · 0.85
load_entriesFunction · 0.70
summarize_entriesFunction · 0.70
report_from_rowsFunction · 0.70
first_columnFunction · 0.50

Tested by

no test coverage detected