Repository: serverless/serverless (JavaScript) — Bug Fix

Issue:
Make sure the `config` command is not displayed in the command list
# This is a (Bug Report / Feature Proposal)

## Description

The config command does nothing since we only support config credentials for now.

## Additional Data

* ***Serverless Framework Version you're using***: latest master
* ***Operating System***:
* ***Stack Trace***:
* ***Provider Error messages***:



Discussion:
I would propose to rename this to `commands w/o implementation shouldn't show up in help`.

We should update the `PluginManager` so that commands without an implementation are not displayed.
I can work on this tomorrow so you can focus on the metrics plugin.

@mthenw @eahefnawy any objections doing this?
Shouldn't this already be the case?

https://github.com/serverless/serverless/blob/master/lib/classes/CLI.js#L75

Not exactly sure why it shouldn't show up in command list. It's command as any other.
Yes, but it has no implementation.

It is basically a "dead" command.
Yeah, but if we'll remove that how user will know about this command?
This issue discusses the following problem we have right now.

We've just introduced the `serverless config credentials` command. This command is basically a composition of a main command `config` and a subcommand `credentials`.

We only have an implementation for the combination of the main command and the subcommand (`config credentials`) but not one for the main command (`config`). However the `serverless help` command shows both which might confuse the user.
Oh now I understand! Make sense!
I thought a bit more about it this morning. This could be quite confusing when people develop plugins and just add a command. What if we only hide `config`? It's kind of a special case since we don't want anyone to implement it, but safe it for future usage.

Resolving patch:
diff --git a/lib/plugins/aws/configCredentials/awsConfigCredentials.js b/lib/plugins/aws/configCredentials/awsConfigCredentials.js
index f459727fef1..cab236ccdd0 100644
--- a/lib/plugins/aws/configCredentials/awsConfigCredentials.js
+++ b/lib/plugins/aws/configCredentials/awsConfigCredentials.js
@@ -13,9 +13,6 @@ class AwsConfigCredentials {
     // this will be merged with the core config commands
     this.commands = {
       config: {
-        lifecycleEvents: [
-          'config',
-        ],
         commands: {
           credentials: {
             lifecycleEvents: [
diff --git a/lib/plugins/config/config.js b/lib/plugins/config/config.js
index 4726fd9c56a..fc82bfa9aa2 100644
--- a/lib/plugins/config/config.js
+++ b/lib/plugins/config/config.js
@@ -19,9 +19,6 @@ class Config {
     this.commands = {
       config: {
         usage: 'Configure Serverless',
-        lifecycleEvents: [
-          'config',
-        ],
         commands: {
           credentials: {
             usage: 'Configures a new provider profile for the Serverless Framework',


Test patch:
diff --git a/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js b/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js
index 350d3e5098a..ae118d48b6f 100644
--- a/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js
+++ b/lib/plugins/aws/configCredentials/awsConfigCredentials.test.js
@@ -35,10 +35,8 @@ describe('AwsConfigCredentials', () => {
       expect(awsConfigCredentials.commands.config.commands.credentials).to.not.equal(undefined);
     });
 
-    it('should have the lifecycle event "config"', () => {
-      expect(awsConfigCredentials.commands.config.lifecycleEvents).to.deep.equal([
-        'config',
-      ]);
+    it('should have no lifecycle event', () => {
+      expect(awsConfigCredentials.commands.config.lifecycleEvents).to.equal(undefined);
     });
 
     it('should have the lifecycle event "config" for the "credentials" sub-command', () => {
diff --git a/lib/plugins/config/config.test.js b/lib/plugins/config/config.test.js
index 07919c443ed..df2e4454b89 100644
--- a/lib/plugins/config/config.test.js
+++ b/lib/plugins/config/config.test.js
@@ -25,10 +25,8 @@ describe('Config', () => {
       expect(config.commands.config.commands.credentials).to.not.equal(undefined);
     });
 
-    it('should have the lifecycle event "config"', () => {
-      expect(config.commands.config.lifecycleEvents).to.deep.equal([
-        'config',
-      ]);
+    it('should have no lifecycle event', () => {
+      expect(config.commands.config.lifecycleEvents).to.deep.equal(undefined);
     });
 
     it('should have the lifecycle event "config" for the "credentials" sub-command', () => {