Add Command Registration through Read Directory method#48
Open
SanyamPunia wants to merge 5 commits intoleopardslab:masterfrom
SanyamPunia:master
Open
Add Command Registration through Read Directory method#48SanyamPunia wants to merge 5 commits intoleopardslab:masterfrom SanyamPunia:master
SanyamPunia wants to merge 5 commits intoleopardslab:masterfrom
SanyamPunia:master
Conversation
TheLukaszNs
suggested changes
Dec 7, 2018
TheLukaszNs
left a comment
There was a problem hiding this comment.
This PR has some mistakes that should be resolved in order to think about merging this work 😃
bin/clocal-gcp
Outdated
|
|
||
| const program = require('commander'); | ||
|
|
||
| const FunctionalArray = require('../src/serviceCounter/API') |
There was a problem hiding this comment.
Where did this come from? 😕
I don't see this file in the clocal-gcp project.
bin/clocal-gcp
Outdated
| for(var i = 0; i < length;i++){ | ||
| const ServicesCmdBash = require('../src/services/cli-commands/'+items[i]+'/cmd'); | ||
| commandsArray = [ServicesCmdBash]; | ||
| program.version(<Version>).description('Clocal GCP'); |
There was a problem hiding this comment.
What does <Version> mean? It is neither a variable nor any of js statement.
bin/clocal-gcp
Outdated
| program.version(<Version>).description('Clocal GCP'); | ||
|
|
||
| const commandNameList = [FunctionalArray]; | ||
| commandsArray.map(command => { |
There was a problem hiding this comment.
You could use forEach instead of map because map is used to create new arrays out of existing ones
Suggested change
| commandsArray.map(command => { | |
| commandsArray.forEach(command => { |
I have done the required changes told by TheLukaszNs. Thanks
dilantha111
requested changes
Dec 8, 2018
bin/clocal-gcp
Outdated
|
|
||
| const program = require('commander'); | ||
|
|
||
| const commandsArray = require('../src/services/index').commands; |
Collaborator
There was a problem hiding this comment.
what we need to do is replacing this with dynamic command registering.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✔️ Before using the Read Directory method, the register commands were executed by explicitly putting them in an index.js file in the services folder.
✔️ After using the given methodology, commands are executed directly without putting them in index.js file.