gather_all_code_from_crates/
gather_all_code_from_crates_main.rs

1crate::ix!();
2
3pub fn gather_all_code_from_crates_main() -> Result<ExitCode,AppError> {
4
5    configure_tracing();
6
7    let effective_config = build_effective_config_from_cli()?;
8
9    let mut output = String::new();
10    for crt in effective_config.crates() {
11        match process_crate_directory(crt, effective_config.criteria()) {
12            Ok(res) => {
13                output.push_str(&res);
14            }
15            Err(e) => {
16                eprintln!("Error processing crate: {:?}, e: {:#?}", crt,e);
17                return Ok(ExitCode::FAILURE);
18            }
19        }
20    }
21
22    let stdout = std::io::stdout();
23    let mut handle = stdout.lock();
24    if handle.write_all(output.as_bytes()).is_err() {
25        return Ok(ExitCode::FAILURE);
26    }
27
28    Ok(ExitCode::SUCCESS)
29}