swc_cli_impl/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use clap::Parser;
use commands::{Command, CommandRunner, PluginSubcommand, SwcCliOptions};

mod commands;
mod util;

pub fn run() -> anyhow::Result<()> {
    let command = SwcCliOptions::parse().command;

    match &command {
        Command::Plugin(PluginSubcommand::New(options)) => options.execute(),
        Command::Compile(options) => options.execute(),
        Command::Minify(options) => options.execute(),
        Command::Bundle(options) => options.execute(),
        Command::Lint(options) => options.execute(),
    }
}