Commit d57b8dc5 authored by xsahxl's avatar xsahxl
Browse files

fix: :bug: 修复自定义指令帮助信息

No related merge requests found
Showing with 11 additions and 6 deletions
+11 -6
{
"name": "@serverless-devs/s",
"version": "2.0.100-beta.10",
"version": "2.0.100-beta.11",
"description": "Serverless devs tool, serverless developer tool, supports Alibaba cloud, AWS, azure, baidu cloud, Huawei cloud, Google cloud and Tencent cloud.",
"homepage": "https://www.serverless-devs.com",
"keywords": [
......
import program from '@serverless-devs/commander';
import { registerCommandChecker, logger } from './utils';
import { join } from 'lodash';
import { join, includes } from 'lodash';
import { emoji, getVersion } from './utils/common';
import UpdateNotifier from './update-notifier';
import onboarding from './onboarding';
import { HandleError } from './error';
import SpecialCommad from './special-commad';
import help from './help';
import { COMMAND_LIST } from './constant';
const pkg = require('../package.json');
(async () => {
......@@ -41,7 +42,14 @@ const pkg = require('../package.json');
return await onboarding();
}
await help(system_command);
await new SpecialCommad(system_command).init();
if (includes(COMMAND_LIST, process.argv[2])) {
system_command.parse(process.argv);
} else {
// 自定义指令: s deploy
await new SpecialCommad(system_command).init();
system_command.parse(process.argv.filter(o => o !== '-h'));
}
system_command.exitOverride(async error => {
if (error.code === 'commander.help') {
......@@ -51,7 +59,6 @@ const pkg = require('../package.json');
process.exit(0);
}
});
system_command.parse(process.argv.filter(o => o !== '-h'));
})().catch(async error => {
await HandleError(error);
});
......
import { CommanderStatic, Command } from '@serverless-devs/commander';
import core from '../utils/core';
import { isEmpty, includes, keys, get } from 'lodash';
import { COMMAND_LIST } from '../constant';
const { getGlobalArgs, execCommand, getTemplatePath, getYamlContent } = core;
class SpecialCommad {
constructor(private command: CommanderStatic) {}
async init() {
if (includes(COMMAND_LIST, process.argv[2])) return;
const argv = getGlobalArgs(process.argv.slice(2));
const { _: rawData, template, access, 'skip-actions': skipActions, debug } = argv;
if (isEmpty(rawData)) return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment