Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add Command Registration through Read Directory method #48

wants to merge 5 commits into from

Conversation

SanyamPunia
Copy link
Contributor

✔️ 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.

Copy link

@TheLukaszNs TheLukaszNs left a 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')

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');

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 => {

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

Suggested change
commandsArray.map(command => {
commandsArray.forEach(command => {

I have done the required changes told by TheLukaszNs.
Thanks
Copy link
Collaborator

@dilantha111 dilantha111 left a 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;
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants