generate help when no commands are provided

This commit is contained in:
Eslam A. Hefnawy 2015-12-07 13:22:15 +02:00
parent b4d2cd4363
commit 00e099152f
2 changed files with 4 additions and 5 deletions

View File

@ -125,9 +125,8 @@ class Serverless {
command(argv) {
SUtils.sDebug('command argv', argv);
// Handle version command
if (argv.version) {
if (argv._[0] === 'version') {
console.log(this._version);
return BbPromise.resolve();
}
@ -137,7 +136,7 @@ class Serverless {
this.cli = {}; //options and args that the command was called with on the CLI so plugins can leverage
if (argv.help || argv.h) {
if (argv._.length === 0 || argv._[0] === 'help' || argv._[0] === 'h') {
if (!this.commands[cmdContext]) {
return SCli.generateMainHelp(this.commands);
} else if (this.commands[cmdContext] && !this.commands[cmdContext][cmdContextAction]) {

View File

@ -12,7 +12,7 @@ describe('All Tests', function() {
after(function() {});
//require('./tests/actions/TestPluginCustom');
//require('./tests/actions/TestDefaultActionHook');
require('./tests/actions/TestDefaultActionHook');
//require('./tests/actions/ProjectCreate');
//require('./tests/actions/StageCreate');
//require('./tests/actions/RegionCreate');
@ -23,7 +23,7 @@ describe('All Tests', function() {
//require('./tests/actions/EnvGet');
//require('./tests/actions/EnvSetUnset');
//require('./tests/actions/ResourcesDeploy');
require('./tests/actions/FunctionRun');
//require('./tests/actions/FunctionRun');
//require('./tests/actions/FunctionDeploy');
});