Skip to content

Commit 53cda32

Browse files
authoredMay 17, 2024··
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.
1 parent 61d5771 commit 53cda32

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed
 

‎lib/commands/ls.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,14 @@ class LS extends ArboristWorkspaceCmd {
177177
const [rootError] = tree.errors.filter(e =>
178178
e.code === 'EJSONPARSE' && e.path === resolve(path, 'package.json'))
179179

180-
output.buffer(
181-
json ? jsonOutput({ path, problems, result, rootError, seenItems }) :
182-
parseable ? parseableOutput({ seenNodes, global, long }) :
183-
humanOutput({ chalk, result, seenItems, unicode })
184-
)
180+
if (json) {
181+
output.buffer(jsonOutput({ path, problems, result, rootError, seenItems }))
182+
} else {
183+
output.standard(parseable
184+
? parseableOutput({ seenNodes, global, long })
185+
: humanOutput({ chalk, result, seenItems, unicode })
186+
)
187+
}
185188

186189
// if filtering items, should exit with error code on no results
187190
if (result && !result[_include] && args.length) {

0 commit comments

Comments
 (0)
Please sign in to comment.