swc_cli_impl/commands/
mod.rs

1use clap::{Parser, Subcommand};
2
3mod bundle;
4mod compile;
5mod lint;
6mod minify;
7mod plugin;
8
9pub use bundle::*;
10pub use compile::*;
11pub use lint::*;
12pub use minify::*;
13pub use plugin::PluginSubcommand;
14
15// Set of subcommands supported by the `swc` command.
16#[derive(Subcommand)]
17pub enum Command {
18    /// Commandline utilities for creating, building plugins.
19    #[clap(subcommand)]
20    Plugin(PluginSubcommand),
21    /// Run SWC's transformer.
22    Compile(Box<CompileOptions>),
23    Bundle(BundleOptions),
24    Minify(MinifyOptions),
25    Lint(LintOptions),
26}
27
28#[derive(Parser)]
29#[clap(name = "SWC", version, propagate_version = true)]
30pub struct SwcCliOptions {
31    #[clap(subcommand)]
32    pub command: Command,
33}
34
35pub trait CommandRunner {
36    fn execute(&self) -> anyhow::Result<()>;
37}