Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions bin/clocal-gcp
Original file line number Diff line number Diff line change
Expand Up @@ -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.


program.version('1.0.0').description('Clocal GCP');

const commandNameList = [];

commandsArray.map(command => {
let length = items.length;
for(var i = 0; i < length;i++){
const ServicesCmdBash = require('../src/services/cli-commands/'+items[i]+'/cmd');
commandsArray = [ServicesCmdBash];
program.version('1.0.0').description('Clocal GCP');

const commandNameList = [FunctionalArray];
commandsArray.forEach(command => {
commandNameList.push(command.commandName);
program.command(command.commandName).action(command.action);
});

}

program.command('list').action(() => {
const commandNames = commandNameList.reduce((prev, current) => {
return `${prev}\n${current}`;
Expand Down