1use ast::AstCommand;
2use clap::builder::styling::AnsiColor;
3use clap::builder::styling::Effects;
4use clap::builder::Styles;
5use clap::Parser;
6
7use crate::commands::fix::FixCommand;
8use crate::commands::format::FormatCommand;
9use crate::commands::lint::LintCommand;
10
11pub mod ast;
12pub mod fix;
13pub mod format;
14pub mod lint;
15
16pub const CLAP_STYLING: Styles = Styles::styled()
17 .header(AnsiColor::Green.on_default().effects(Effects::BOLD))
18 .usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
19 .literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
20 .placeholder(AnsiColor::Cyan.on_default())
21 .error(AnsiColor::Red.on_default().effects(Effects::BOLD))
22 .valid(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
23 .invalid(AnsiColor::Yellow.on_default().effects(Effects::BOLD));
24
25#[derive(Parser, Debug)]
26#[command(
27 version,
28 styles = CLAP_STYLING,
29 long_about = r#"
31--------------------------------------------------------------------------
32 /\ /\ |
33 //\\_//\\ ____ | Mago 🦊 is an all-in-one, oxidized PHP toolchain,
34 \_ _/ / / | built to handle everything from static analysis and
35 / * * \ /^^^] | refactoring to full project management.
36 \_\O/_/ [ ] |
37 / \_ [ / |
38 \ \_ / / |
39 [ [ / \/ _/ | https://carthage.software/mago
40 _[ [ \ /_/ |
41--------------------------------------------------------------------------
42"#,
43)]
44pub enum MagoCommand {
45 #[command(name = "lint")]
46 Lint(LintCommand),
47 #[command(name = "fix")]
48 Fix(FixCommand),
49 #[command(name = "format")]
50 Format(FormatCommand),
51 #[command(name = "ast")]
52 Ast(AstCommand),
53}