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

Function run

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

Source from the content-addressed store, hash-verified

13};
14
15pub(crate) fn run(args: AgentCommandArgs) -> Result<()> {
16 let shared = args.shared;
17 let mut entries = loader::load_entries(&shared)?;
18 filter_loaded_entries_by_date(&mut entries, &shared);
19 if wants_json(&shared) {
20 return print_json_or_jq(
21 report_json(&entries, args.kind, &shared.order)?,
22 shared.jq.as_deref(),
23 shared.no_cost,
24 );
25 }
26 let mut rows = summarize_entries(&entries, args.kind)?;
27 sort_summaries(&mut rows, &shared.order, |row| summary_period(row));
28 print_usage_table(
29 "OpenCode Token Usage Report",
30 first_column(args.kind),
31 &rows,
32 &shared,
33 false,
34 None,
35 )?;
36 Ok(())
37}

Callers

nothing calls this directly

Calls 10

wants_jsonFunction · 0.85
print_json_or_jqFunction · 0.85
sort_summariesFunction · 0.85
print_usage_tableFunction · 0.85
load_entriesFunction · 0.70
report_jsonFunction · 0.70
summarize_entriesFunction · 0.70
summary_periodFunction · 0.70
first_columnFunction · 0.70

Tested by

no test coverage detected