Skip to content

Commit

Permalink
fix: refactor ls to use output.buffer for json (#7542)
Browse files Browse the repository at this point in the history
This has no functional difference but matches where
we landed for the rest of the commands.
  • Loading branch information
lukekarrys committed May 17, 2024
1 parent 61d5771 commit 53cda32
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/commands/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 53cda32

Please sign in to comment.