Documentation
/*!
这是执行程序所在的包
 */

use std::process;
use crate::config::{get_config, MyCommand, print_help_info};
use crate::runner::init::runner_init;

mod run;
mod init;

///执行命令
pub fn run() {
    //读取参数
    let conf = get_config().unwrap_or_else(|e| {
        println!("参数解析异常: {}", e);
        process::exit(1);
    });
    //匹配命令
    //1.init    --初始化项目
    //2.run     --运行编译服务器
    //3.build   --打包
    //0.help    --帮助目录
    match conf.command {
        MyCommand::INIT => {
            runner_init(conf).unwrap_or_else(|e| {
                println!("初始化异常: {e}");
                process::exit(1);
            })
        }
        MyCommand::RUN => {}
        MyCommand::BUILD => {}
        _ => { print_help_info() }
    }
}