From 1293f2e853aed16ef3cfaec61b035431ca7be3fa Mon Sep 17 00:00:00 2001 From: i-solar Date: Mon, 29 Jul 2019 15:06:14 +0800 Subject: [PATCH 1/2] fix: feflow cover plugin arguments. --- lib/feflow.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/feflow.js b/lib/feflow.js index af33d034..28764f89 100644 --- a/lib/feflow.js +++ b/lib/feflow.js @@ -59,22 +59,22 @@ function entry(args) { } return feflow.init().then(function () { - let cmd = ''; + // outer command + let cmd = args._.shift(); - if (args.v || args.version) { - console.log(`v${feflow.version}`); - return; - } else if (!args.h && !args.help) { - cmd = args._.shift(); - - if (cmd) { - let c = feflow.cmd.get(cmd); - if (!c) cmd = 'help'; + // if don't have outer command, maybe have -v or -h arguments. + if (!cmd) { + if (args.v || args.version) { + return console.log(`v${feflow.version}`); + } else if (args.h || args.help) { + cmd = 'help'; } else { - printBanner(); - return; + return printBanner(); } - } else { + } + + // if command is not registering, replace to 'help' command. + if (!feflow.cmd.get(cmd)) { cmd = 'help'; } From 562fee505a3a4b8cf32ea735777119ece73169d1 Mon Sep 17 00:00:00 2001 From: i-solar Date: Mon, 29 Jul 2019 15:38:21 +0800 Subject: [PATCH 2/2] fix: allow plugin use origin command arguments. --- lib/core/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/index.js b/lib/core/index.js index a10443e6..f2a14b71 100644 --- a/lib/core/index.js +++ b/lib/core/index.js @@ -45,7 +45,10 @@ class Feflow { silent: Boolean(args.silent) }); + // Bug: https://github.com/Tencent/feflow/issues/107 this.args = camelizeKeys(args); + // Can use origin arguments. + this.rawArgs = args; this.cmd = new Command(); @@ -75,7 +78,7 @@ class Feflow { require('../internal/deploy')(this); require('../internal/clean')(this); require('../internal/create')(this); - + // Init client and load external plugins return Promise.each([ 'initClient',