-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Command Registration through Read Directory method #48
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR has some mistakes that should be resolved in order to think about merging this work 😃
bin/clocal-gcp
Outdated
@@ -3,18 +3,23 @@ | |||
'use strict'; | |||
|
|||
const program = require('commander'); | |||
|
|||
const FunctionalArray = require('../src/serviceCounter/API') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use forEach
instead of map
because map
is used to create new arrays out of existing ones
commandsArray.map(command => { | |
commandsArray.forEach(command => { |
I have done the required changes told by TheLukaszNs. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registering commands dynamically is not there.
bin/clocal-gcp
Outdated
@@ -3,18 +3,22 @@ | |||
'use strict'; | |||
|
|||
const program = require('commander'); | |||
|
|||
const commandsArray = require('../src/services/index').commands; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what we need to do is replacing this with dynamic command registering.
✔️ 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.