@@ -4,7 +4,14 @@ import { cpus } from 'os';
44import { Writable } from 'stream' ;
55import treeKill from 'tree-kill' ;
66
7- import { CloseEvent , Command , CommandInfo , KillProcess , SpawnCommand } from './command' ;
7+ import {
8+ CloseEvent ,
9+ Command ,
10+ CommandIdentifier ,
11+ CommandInfo ,
12+ KillProcess ,
13+ SpawnCommand ,
14+ } from './command' ;
815import { CommandParser } from './command-parser/command-parser' ;
916import { ExpandArguments } from './command-parser/expand-arguments' ;
1017import { ExpandNpmShortcut } from './command-parser/expand-npm-shortcut' ;
@@ -94,6 +101,11 @@ export type ConcurrentlyOptions = {
94101 */
95102 raw ?: boolean ;
96103
104+ /**
105+ * Which command(s) should have their output hidden.
106+ */
107+ hide ?: CommandIdentifier | CommandIdentifier [ ] ;
108+
97109 /**
98110 * The current working directory of commands which didn't specify one.
99111 * Defaults to `process.cwd()`.
@@ -169,6 +181,13 @@ export function concurrently(
169181 commandParsers . push ( new ExpandArguments ( options . additionalArguments ) ) ;
170182 }
171183
184+ // To avoid empty strings from hiding the output of commands that don't have a name,
185+ // keep in the list of commands to hide only strings with some length.
186+ // This might happen through the CLI when no `--hide` argument is specified, for example.
187+ const hide = _ . castArray ( options . hide )
188+ . filter ( ( name ) => name || name === 0 )
189+ . map ( String ) ;
190+
172191 let commands = _ ( baseCommands )
173192 . map ( mapToCommandInfo )
174193 . flatMap ( ( command ) => parseCommand ( command , commandParsers ) )
@@ -183,6 +202,7 @@ export function concurrently(
183202 raw : command . raw ?? options . raw ,
184203 env : command . env ,
185204 cwd : command . cwd || options . cwd ,
205+ hide : hide . includes ( String ( index ) ) || hide . includes ( command . name ) ,
186206 } ) ,
187207 options . spawn ,
188208 options . kill ,
0 commit comments