mago_cli/commands/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use ast::AstCommand;
use clap::builder::styling::AnsiColor;
use clap::builder::styling::Effects;
use clap::builder::Styles;
use clap::Parser;

use crate::commands::fix::FixCommand;
use crate::commands::format::FormatCommand;
use crate::commands::lint::LintCommand;

pub mod ast;
pub mod fix;
pub mod format;
pub mod lint;

pub const CLAP_STYLING: Styles = Styles::styled()
    .header(AnsiColor::Green.on_default().effects(Effects::BOLD))
    .usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
    .literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
    .placeholder(AnsiColor::Cyan.on_default())
    .error(AnsiColor::Red.on_default().effects(Effects::BOLD))
    .valid(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
    .invalid(AnsiColor::Yellow.on_default().effects(Effects::BOLD));

#[derive(Parser, Debug)]
#[command(
    version,
    styles = CLAP_STYLING,
    // Ascii art by Todd Vargo (https://ascii.co.uk/art/fox)
    long_about = r#"
--------------------------------------------------------------------------
  /\   /\            |
 //\\_//\\     ____  | Mago 🦊 is an all-in-one, oxidized PHP toolchain,
 \_     _/    /   /  | built to handle everything from static analysis and
  / * * \    /^^^]   | refactoring to full project management.
  \_\O/_/    [   ]   |
   /   \_    [   /   |
   \     \_  /  /    |
    [ [ /  \/ _/     | https://carthage.software/mago
   _[ [ \  /_/       |
--------------------------------------------------------------------------
"#,
)]
pub enum MagoCommand {
    #[command(name = "lint")]
    Lint(LintCommand),
    #[command(name = "fix")]
    Fix(FixCommand),
    #[command(name = "format")]
    Format(FormatCommand),
    #[command(name = "ast")]
    Ast(AstCommand),
}