Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Close npm#807 Print (empty) if the dir is empty
  • Loading branch information
isaacs committed Apr 13, 2011
1 parent 6818ac1 commit 6b03eb0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ls.js
Expand Up @@ -66,6 +66,7 @@ function bfsify (root, current, queue, seen) {


function makePretty (data, long, dir, prefix, list) {
var top = !list
list = list || []
prefix = prefix || ""
list.push(format(data, long, prefix, dir))
Expand Down Expand Up @@ -105,6 +106,10 @@ function makePretty (data, long, dir, prefix, list) {
var c = i === depLast ? "└─" : "├─"
makePretty(depData, long, dir, childPref + c, list)
})
if (top && list.length === 1 && !data._id) {
if (!npm.config.get("parseable")) list.push("(empty)")
else if (npm.config.get("long")) list[0] += ":EMPTY"
}
return list.filter(function (l) { return l.trim() })
}

Expand Down

0 comments on commit 6b03eb0

Please sign in to comment.