From 53cda32aa35f3a592fb0ddf37e43c028f93ef613 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 17 May 2024 10:38:53 -0700 Subject: [PATCH] fix: refactor ls to use output.buffer for json (#7542) This has no functional difference but matches where we landed for the rest of the commands. --- lib/commands/ls.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/commands/ls.js b/lib/commands/ls.js index 7dbe14fea20bc..a826b52832750 100644 --- a/lib/commands/ls.js +++ b/lib/commands/ls.js @@ -177,11 +177,14 @@ class LS extends ArboristWorkspaceCmd { const [rootError] = tree.errors.filter(e => e.code === 'EJSONPARSE' && e.path === resolve(path, 'package.json')) - output.buffer( - json ? jsonOutput({ path, problems, result, rootError, seenItems }) : - parseable ? parseableOutput({ seenNodes, global, long }) : - humanOutput({ chalk, result, seenItems, unicode }) - ) + if (json) { + output.buffer(jsonOutput({ path, problems, result, rootError, seenItems })) + } else { + output.standard(parseable + ? parseableOutput({ seenNodes, global, long }) + : humanOutput({ chalk, result, seenItems, unicode }) + ) + } // if filtering items, should exit with error code on no results if (result && !result[_include] && args.length) {