#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Commander = require("commander");
const engine_1 = require("./engine");
const Case = require("../../case/src");
const pkg = require('../../../package.json');
Commander.version(`${pkg.version}`);
Commander
    .command('build')
    .description('编译工程')
    .option('-p, --path <v>', '目标工程路径')
    .option('-d, --dist <v>', '编译结果路径')
    .action(cmd => {
    engine_1.AntCube.pack.buildProject(cmd.path, cmd.dist).then(value => {
        if (value.success) {
            console.log(`success`);
            process.exit(0);
        }
        else {
            console.log(`${value.message}`);
            process.exit(1);
        }
    }).catch(reason => {
        console.error(`build project failure\n${reason.message}`);
        process.exit(1);
    });
});
Commander
    .command('case')
    .description('用例管理')
    .option('-i, --init <v>', '用例关联page工程根目录，支持将多个工程放置在同一个目录下批量处理')
    .action(cmd => {
    if (cmd.init) {
        console.log(`开始创建用例...\n`);
        const engine = new Case.Engine();
        engine.createCases(cmd.init).then(value => {
            console.log(`\n用例创建完成`);
            process.exit(0);
        }).catch(reason => {
            console.error(`\n用例创建失败:\n${reason.message}`);
            process.exit(1);
        });
    }
    else {
        console.error(`无效的入参!`);
        process.exit(2);
    }
});
Commander.parse(process.argv);
//# sourceMappingURL=cli.js.map