File tree Expand file tree Collapse file tree 6 files changed +464
-241
lines changed Expand file tree Collapse file tree 6 files changed +464
-241
lines changed Original file line number Diff line number Diff line change 11const pjson = require ( './package.json' )
22const io = require ( 'socket.io-client' )
3- const colors = require ( 'colors' )
43const url = require ( 'url' )
54const pretty = require ( './helpers/pretty' )
65const services = require ( './services' )
Original file line number Diff line number Diff line change 1- const colors = require ( 'colors' )
2-
3- /**
4- * Given an std output (either stdout or stderr) in either array or string
5- * format, convert it to an array and remove empty lines.
6- *
7- * For example, if a command outputs the following:
8- *
9- * - Command in progress...
10- * -
11- * - Please wait a moment.
12- * -
13- *
14- * The result must look like:
15- *
16- * ['Command in progress...', 'Please wait a moment.']
17- *
18- * @param {Array|string } input std to be converted into a filtered array.
19- * @returns {Array } List of strings from the original input.
20- */
21- const parseStd = ( input ) => {
22- //
23- if ( ! input ) return [ ]
24- try {
25- return ( Array . isArray ( input ) ? input : input . toString ( ) . split ( '\n' ) )
26- . map ( l => l . trim ( ) )
27- . filter ( Boolean ) || null
28- }
29- catch ( ex ) {
30- console . error ( ex )
31- return [ ]
32- }
33- }
34-
35- module . exports . parseStd = parseStd
36-
371/**
382 * Reports stds outputed by the in-execution command.
393 *
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22'use strict'
33const program = require ( 'commander' )
4- const colors = require ( 'colors' )
54const url = require ( 'url' )
65const os = require ( 'os' )
76const pkg = require ( './package.json' )
You can’t perform that action at this time.
0 commit comments