surgio
Version:
Generating rules for Surge, Clash, Quantumult like a PRO
37 lines • 1.4 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// istanbul ignore file
const path_1 = require("path");
const core_1 = require("@oclif/core");
const hygen_1 = require("@royli/hygen");
const base_command_1 = __importDefault(require("../base-command"));
const defaultTemplates = (0, path_1.join)(__dirname, '../../hygen-template');
class NewCommand extends base_command_1.default {
static description = '新建文件助手';
async run() {
const args = [...this.argv].concat('new'); // [type] new ...
await (0, hygen_1.runner)(args, {
templates: defaultTemplates,
cwd: this.projectDir,
logger: new hygen_1.Logger(console.log.bind(console)),
createPrompter: () => require('inquirer'),
exec: async (action, body) => {
const opts = body && body.length > 0 ? { input: body } : {};
await require('execa')(action, opts);
},
});
await this.cleanup();
}
}
NewCommand.args = {
type: core_1.Args.custom({
description: '文件类型',
required: true,
options: ['provider', 'template', 'artifact'],
})(),
};
exports.default = NewCommand;
//# sourceMappingURL=new.js.map