Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 1x 1x 1x | 'use strict'; import {each, first} from 'lodash'; import {listSubfoldersFilesByFolderName} from '@owservable/folders'; import ActionAsCommandInterface from '../interfaces/action.as.command.interface'; export const findCommandAction = (root: string, cliCommand: string): ActionAsCommandInterface => { const actionPaths: string[] = listSubfoldersFilesByFolderName(root, 'actions'); let action: ActionAsCommandInterface; each(actionPaths, (actionPath: string) => { console.log('[@owservable/actions] -> Initializing command action', actionPath); // tslint:disable-next-line:callable-types const ActionClass: {new (): ActionAsCommandInterface} = require(actionPath).default; const actionInstance = new ActionClass(); const actionCommand = first(actionInstance.signature().split(' ')); Iif (cliCommand === actionCommand) { action = actionInstance; return false; } }); return action; }; export default findCommandAction; |