1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
module.exports = bugs
bugs.usage = "npm bugs <pkgname>"
var npm = require("./npm.js")
, log = require("npmlog")
, opener = require("opener")
, fetchPackageMetadata = require("./fetch-package-metadata.js")
, mapToRegistry = require("./utils/map-to-registry.js")
, registry = npm.registry
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://npmjs.org/package/" + d.name
}
log.silly("bugs", "url", url)
opener(url, { command: npm.config.get("browser") }, cb)
})
}
|