Skip to main content

grip/
lib.rs

1// Copyright 2026 Umberto Gotti <umberto.gotti@umbertogotti.dev>
2// Licensed under the MIT License
3// SPDX-License-Identifier: MIT
4
5pub mod app;
6pub mod args;
7pub mod cache;
8pub mod collector;
9pub mod config;
10pub mod default_scorer;
11pub mod fs_walk;
12pub mod grip_report;
13pub mod item_counts;
14pub mod module_stats;
15pub mod offender;
16pub mod overall_stats;
17pub mod stdout_reporter;
18pub mod traits;
19pub mod unsafe_finder;
20
21use std::process::ExitCode;
22
23use anyhow::Result;
24use clap::Parser;
25
26use crate::app::App;
27use crate::args::Args;
28use crate::config::Config;
29
30pub fn run() -> Result<ExitCode> {
31    let args = Args::parse();
32    let config = Config::from_args(args);
33    App::new(config).run()
34}
35
36pub fn run_from_args<I, T>(args: I) -> Result<ExitCode>
37where
38    I: IntoIterator<Item = T>,
39    T: Into<std::ffi::OsString> + Clone,
40{
41    let args = Args::parse_from_args(args);
42    let config = Config::from_args(args);
43    App::new(config).run()
44}