(parser: &mut ArgParser, shared: &mut SharedArgs)
| 574 | } |
| 575 | |
| 576 | fn parse_shared_arg(parser: &mut ArgParser, shared: &mut SharedArgs) -> Result<(), String> { |
| 577 | match parser.next_flag()?.as_str() { |
| 578 | "-s" | "--since" => { |
| 579 | shared.since = Some(normalize_date_bound(&parser.value_for("--since")?)) |
| 580 | } |
| 581 | "-u" | "--until" => { |
| 582 | shared.until = Some(normalize_date_bound(&parser.value_for("--until")?)) |
| 583 | } |
| 584 | "-j" | "--json" => shared.json = true, |
| 585 | "-m" | "--mode" => shared.mode = parse_cost_mode(&parser.value_for("--mode")?)?, |
| 586 | "-d" | "--debug" => shared.debug = true, |
| 587 | "--debug-samples" => { |
| 588 | shared.debug_samples = parser |
| 589 | .value_for("--debug-samples")? |
| 590 | .parse() |
| 591 | .map_err(|_| "Invalid value for --debug-samples".to_string())? |
| 592 | } |
| 593 | "-o" | "--order" => shared.order = parse_sort_order(&parser.value_for("--order")?)?, |
| 594 | "-b" | "--breakdown" => shared.breakdown = true, |
| 595 | "-O" | "--offline" => shared.offline = true, |
| 596 | "--no-offline" => shared.no_offline = true, |
| 597 | "--color" => shared.color = true, |
| 598 | "--no-color" => shared.no_color = true, |
| 599 | "-z" | "--timezone" => shared.timezone = Some(parser.value_for("--timezone")?), |
| 600 | "-q" | "--jq" => shared.jq = Some(parser.value_for("--jq")?), |
| 601 | "--config" => shared.config = Some(PathBuf::from(parser.value_for("--config")?)), |
| 602 | "--compact" => shared.compact = true, |
| 603 | "--single-thread" => shared.single_thread = true, |
| 604 | "--no-cost" => shared.no_cost = true, |
| 605 | flag => return Err(format!("Unknown option '{flag}'")), |
| 606 | } |
| 607 | Ok(()) |
| 608 | } |
| 609 | |
| 610 | fn is_command(arg: &str) -> bool { |
| 611 | matches!( |
no test coverage detected