All files / src/cli hooks.js

66.67% Statements 12/18
0% Branches 0/4
0% Functions 0/1
57.14% Lines 8/14

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 30 31 32 331x 1x 1x   1x 1x 1x           1x                                     1x  
import chalk from 'chalk';
import { logTask } from '../common';
import { listHooks, executeHook, listPipes } from '../projectTools/buildHooks';
 
const RUN = 'run';
const LIST = 'list';
const PIPES = 'pipes';
 
// ##########################################
// PUBLIC API
// ##########################################
 
const run = (c) => {
    logTask('run');
 
    switch (c.subCommand) {
    case RUN:
        return executeHook(c);
    case LIST:
        return listHooks(c);
    case PIPES:
        return listPipes(c);
    default:
        return Promise.reject(`cli:hooks: Sub-Command ${chalk.white.bold(c.subCommand)} not supported!`);
    }
};
 
// ##########################################
// PRIVATE
// ##########################################
 
export default run;