(program: Command)
| 20 | }; |
| 21 | |
| 22 | const root = async (program: Command) => { |
| 23 | program |
| 24 | .name('s') |
| 25 | .option('--debug', 'Open debug model') |
| 26 | .addOption(new Option('--skip-actions', 'Skip the extends section').hideHelp()) |
| 27 | .option('-t, --template <path>', 'Specify the template file') |
| 28 | .option('-a, --access <aliasName>', 'Specify the access alias name') |
| 29 | .addOption(new Option('--output <outputFormat>', 'Specify the output format').choices(['default', 'json', 'yaml', 'raw']).hideHelp()) |
| 30 | .addOption(new Option('-o, --output-format <outputFormat>', 'Specify the output format').choices(['default', 'json', 'yaml', 'raw'])) |
| 31 | .addOption(new Option('--output-file <outputFilePath>', 'Specify the output file path').hideHelp()) |
| 32 | .addOption(new Option('--env <envName>', 'Specify the env name').hideHelp()) |
| 33 | .addOption(new Option('--no-verify', 'Do not verify yaml').hideHelp()) |
| 34 | .option('--silent', 'Silent mode') |
| 35 | .addOption(new Option('--baseline-template <path>', 'Baseline Yaml file to do diff on').hideHelp()) |
| 36 | .configureHelp({ showGlobalOptions: true }) |
| 37 | .helpOption('-h, --help', 'Display help for command') |
| 38 | .addHelpCommand(false) |
| 39 | .version(getVersion(), '-v, --version', 'Show version information'); |
| 40 | |
| 41 | const argv = process.argv.slice(2); |
| 42 | const { version, _: rest } = parseArgv(argv); |
| 43 | if (version) return; |
| 44 | let customRootHelp = null; |
| 45 | |
| 46 | // 支持的系统命令 |
| 47 | if (rest.length !== 0) { |
| 48 | if (Object.keys(commandDict).includes(rest[0])) { |
| 49 | if (rest[0] === 'cli') { |
| 50 | await mountAsync(commandDict[rest[0]], program); |
| 51 | } else { |
| 52 | await mount(commandDict[rest[0]], program); |
| 53 | } |
| 54 | } else { |
| 55 | // 自定义指令,所有的系统的指令必须写在自定义指令之前 否则会被抢先注册 |
| 56 | const Custom = (await import('./custom')).default; |
| 57 | customRootHelp = await new Custom(program).init(); |
| 58 | } |
| 59 | } else { |
| 60 | for (const command of Object.values(commandDict)) { |
| 61 | await mount(command, program); |
| 62 | // 自定义指令,所有的系统的指令必须写在自定义指令之前 否则会被抢先注册 |
| 63 | const Custom = (await import('./custom')).default; |
| 64 | customRootHelp = await new Custom(program).init(); |
| 65 | } |
| 66 | } |
| 67 | // const Custom = require('./custom/index.ts').default; |
| 68 | // customRootHelp = await new Custom(program).init(); |
| 69 | // subConfig(program); |
| 70 | // subEnv(program); |
| 71 | // subSet(program); |
| 72 | // subRegistry(program); |
| 73 | // subPreview(program); |
| 74 | // subComponent(program); |
| 75 | // console.log(subClean.default); |
| 76 | // subClean.default(program); |
| 77 | // subInit(program); |
| 78 | // subVerify(program); |
| 79 | // await subCli(program); // !!!!时间很长 |
nothing calls this directly
no test coverage detected