1use anyhow::Result;
7use clap::{Parser, Subcommand};
8use torrust_linting::{
9 run_clippy_linter, run_markdown_linter, run_rustfmt_linter, run_shellcheck_linter, run_toml_linter, run_yaml_linter,
10};
11
12#[derive(Parser)]
13#[command(name = "custom-linter")]
14#[command(about = "A custom linter CLI using torrust-linting")]
15struct Cli {
16 #[command(subcommand)]
17 command: Commands,
18}
19
20#[derive(Subcommand)]
21enum Commands {
22 Rust,
24 Markup,
26 Shell,
28}
29
30fn main() -> Result<()> {
31 torrust_linting::init_tracing();
33
34 let cli = Cli::parse();
35
36 match cli.command {
37 Commands::Rust => {
38 println!("🦀 Running Rust linters...");
39 run_clippy_linter()?;
40 run_rustfmt_linter()?;
41 }
42 Commands::Markup => {
43 println!("📄 Running markup linters...");
44 run_markdown_linter()?;
45 run_yaml_linter()?;
46 run_toml_linter()?;
47 }
48 Commands::Shell => {
49 println!("🐚 Running shell script linter...");
50 run_shellcheck_linter()?;
51 }
52 }
53
54 println!("✅ All selected linters passed!");
55 Ok(())
56}