]> gerrit.simantics Code Review - simantics/district.git/blob - npm/lib/ping.js
Hide "enabled" column for non-component type tech type tables
[simantics/district.git] / npm / lib / ping.js
1 var npm = require('./npm.js')
2
3 module.exports = ping
4
5 ping.usage = 'npm ping\nping registry'
6
7 function ping (args, silent, cb) {
8   if (typeof cb !== 'function') {
9     cb = silent
10     silent = false
11   }
12   var registry = npm.config.get('registry')
13   if (!registry) return cb(new Error('no default registry set'))
14   var auth = npm.config.getCredentialsByURI(registry)
15
16   npm.registry.ping(registry, {auth: auth}, function (er, pong) {
17     if (!silent) console.log(JSON.stringify(pong))
18     cb(er, er ? null : pong)
19   })
20 }