summaryrefslogtreecommitdiff
path: root/deps/npm/lib/stars.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/stars.js')
-rw-r--r--deps/npm/lib/stars.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/deps/npm/lib/stars.js b/deps/npm/lib/stars.js
new file mode 100644
index 000000000..74841f2de
--- /dev/null
+++ b/deps/npm/lib/stars.js
@@ -0,0 +1,27 @@
+module.exports = stars
+
+stars.usage = "npm stars [username]"
+
+var npm = require("./npm.js")
+ , registry = npm.registry
+ , log = require("npmlog")
+
+function stars (args, cb) {
+ var name = args.length === 1 ? args[0] : npm.config.get("username")
+ registry.stars(name, showstars)
+
+ function showstars (er, data) {
+ if (er) {
+ return cb(er)
+ }
+
+ if (data.rows.length === 0) {
+ log.warn('stars', 'user has not starred any packages.')
+ } else {
+ data.rows.forEach(function(a) {
+ console.log(a.value)
+ })
+ }
+ cb()
+ }
+}