(args: I)
| 1518 | } |
| 1519 | |
| 1520 | pub fn run_cli<I>(args: I) -> Result<u8, DynError> |
| 1521 | where |
| 1522 | I: IntoIterator<Item = String>, |
| 1523 | { |
| 1524 | let config = CliConfig::parse(args)?; |
| 1525 | |
| 1526 | if config.show_help { |
| 1527 | return Ok(0); |
| 1528 | } |
| 1529 | |
| 1530 | if config.list_checkers { |
| 1531 | for checker in supported_checker_names() { |
| 1532 | println!("{checker}"); |
| 1533 | } |
| 1534 | return Ok(0); |
| 1535 | } |
| 1536 | |
| 1537 | let selected = config.selected_checkers.as_ref(); |
| 1538 | let checkers = create_checkers(selected)?; |
| 1539 | let files = collect_input_files(&config.project_root, &config.paths)?; |
| 1540 | let mut processor = MultiCheckerFileProcessor::new(); |
| 1541 | let violations = |
| 1542 | processor.process_files_with_checkers(&files, &checkers, &config.project_root)?; |
| 1543 | |
| 1544 | match config.output_format { |
| 1545 | OutputFormat::Json => { |
| 1546 | println!("{}", serde_json::to_string_pretty(&violations)?); |
| 1547 | } |
| 1548 | OutputFormat::Text => print_text_results(&violations, &config.project_root), |
| 1549 | } |
| 1550 | |
| 1551 | Ok(if violations.is_empty() { 0 } else { 1 }) |
| 1552 | } |
| 1553 | |
| 1554 | #[derive(Debug)] |
| 1555 | struct CliConfig { |
no test coverage detected