/
mod.rs
35 lines (30 loc) · 831 Bytes
/
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
use std::sync::Arc;
use anyhow::Result;
use clap::Subcommand;
use swc_common::SourceMap;
use self::{
compare::CompareCommand, ensure_size::EnsureSize, next::NextCommand, reduce::ReduceCommand,
};
mod compare;
mod ensure_size;
mod next;
mod reduce;
/// Debug the ECMAScript Minifier.
#[derive(Debug, Subcommand)]
pub enum MinifierCommand {
#[clap(subcommand)]
Next(NextCommand),
Reduce(ReduceCommand),
Compare(CompareCommand),
EnsureSize(EnsureSize),
}
impl MinifierCommand {
pub fn run(self, cm: Arc<SourceMap>) -> Result<()> {
match self {
MinifierCommand::Next(cmd) => cmd.run(cm),
MinifierCommand::Reduce(cmd) => cmd.run(cm),
MinifierCommand::EnsureSize(cmd) => cmd.run(cm),
MinifierCommand::Compare(cmd) => cmd.run(cm),
}
}
}