diff --git a/packages/nx/src/command-line/show/command-object.ts b/packages/nx/src/command-line/show/command-object.ts index f445537e2413a..1e94d671f6083 100644 --- a/packages/nx/src/command-line/show/command-object.ts +++ b/packages/nx/src/command-line/show/command-object.ts @@ -14,7 +14,7 @@ export type ShowProjectsOptions = NxShowArgs & { head: string; affected: boolean; projects: string[]; - withTarget: string; + withTarget: string[]; }; export type ShowProjectOptions = NxShowArgs & { @@ -73,6 +73,7 @@ const showProjectsCommand: CommandModule = { type: 'string', alias: ['t'], description: 'Show only projects that have a specific target', + coerce: parseCSV, }) .implies('untracked', 'affected') .implies('uncommitted', 'affected') diff --git a/packages/nx/src/command-line/show/show.ts b/packages/nx/src/command-line/show/show.ts index 4b1a58089209d..edfc050c950d2 100644 --- a/packages/nx/src/command-line/show/show.ts +++ b/packages/nx/src/command-line/show/show.ts @@ -40,7 +40,7 @@ export async function showProjectsHandler( if (args.withTarget) { graph.nodes = Object.entries(graph.nodes).reduce((acc, [name, node]) => { - if (node.data.targets?.[args.withTarget]) { + if (args.withTarget.some((target) => node.data.targets?.[target])) { acc[name] = node; } return acc;