mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
857 B
32 lines
857 B
module.exports = bugs
|
|
|
|
var npm = require('./npm.js')
|
|
var log = require('npmlog')
|
|
var opener = require('opener')
|
|
var fetchPackageMetadata = require('./fetch-package-metadata.js')
|
|
var usage = require('./utils/usage')
|
|
|
|
bugs.usage = usage(
|
|
'bugs',
|
|
'npm bugs [<pkgname>]'
|
|
)
|
|
|
|
bugs.completion = function (opts, cb) {
|
|
// FIXME: there used to be registry completion here, but it stopped making
|
|
// sense somewhere around 50,000 packages on the registry
|
|
cb()
|
|
}
|
|
|
|
function bugs (args, cb) {
|
|
var n = args.length ? args[0] : '.'
|
|
fetchPackageMetadata(n, '.', function (er, d) {
|
|
if (er) return cb(er)
|
|
|
|
var url = d.bugs && ((typeof d.bugs === 'string') ? d.bugs : d.bugs.url)
|
|
if (!url) {
|
|
url = 'https://www.npmjs.org/package/' + d.name
|
|
}
|
|
log.silly('bugs', 'url', url)
|
|
opener(url, { command: npm.config.get('browser') }, cb)
|
|
})
|
|
}
|
|
|