(
groups: &BTreeMap<String, CodexGroup>,
kind: AgentReportKind,
pricing: &PricingMap,
speed: CodexSpeed,
shared: &SharedArgs,
)
| 198 | } |
| 199 | |
| 200 | pub(super) fn print_table_from_groups( |
| 201 | groups: &BTreeMap<String, CodexGroup>, |
| 202 | kind: AgentReportKind, |
| 203 | pricing: &PricingMap, |
| 204 | speed: CodexSpeed, |
| 205 | shared: &SharedArgs, |
| 206 | ) -> Result<()> { |
| 207 | if groups.is_empty() { |
| 208 | eprintln!("No Codex usage data found."); |
| 209 | return Ok(()); |
| 210 | } |
| 211 | let first_column = match kind { |
| 212 | AgentReportKind::Daily => "Date", |
| 213 | AgentReportKind::Weekly => "Week", |
| 214 | AgentReportKind::Monthly => "Month", |
| 215 | AgentReportKind::Session => "Session", |
| 216 | }; |
| 217 | print_box_title( |
| 218 | &format!( |
| 219 | "Codex Token Usage Report - {}", |
| 220 | match kind { |
| 221 | AgentReportKind::Daily => "Daily", |
| 222 | AgentReportKind::Weekly => "Weekly", |
| 223 | AgentReportKind::Monthly => "Monthly", |
| 224 | AgentReportKind::Session => "Session", |
| 225 | } |
| 226 | ), |
| 227 | shared, |
| 228 | ); |
| 229 | let mut headers = vec![ |
| 230 | first_column, |
| 231 | "Models", |
| 232 | "Input", |
| 233 | "Output", |
| 234 | "Reasoning", |
| 235 | "Cache Read", |
| 236 | "Total Tokens", |
| 237 | "Cost (USD)", |
| 238 | ]; |
| 239 | let mut aligns = vec![ |
| 240 | Align::Left, |
| 241 | Align::Left, |
| 242 | Align::Right, |
| 243 | Align::Right, |
| 244 | Align::Right, |
| 245 | Align::Right, |
| 246 | Align::Right, |
| 247 | Align::Right, |
| 248 | ]; |
| 249 | if shared.no_cost { |
| 250 | headers.pop(); |
| 251 | aligns.pop(); |
| 252 | } |
| 253 | let mut table = SimpleTable::new(headers, aligns, crate::terminal_style(shared)) |
| 254 | .with_terminal_width(crate::terminal_width()) |
| 255 | .with_date_compaction(true); |
| 256 | let mut total_input = 0; |
| 257 | let mut total_cached = 0; |
no test coverage detected