"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/bugs.js" (8 Mar 2017, 857 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = bugs
    2 
    3 var npm = require('./npm.js')
    4 var log = require('npmlog')
    5 var opener = require('opener')
    6 var fetchPackageMetadata = require('./fetch-package-metadata.js')
    7 var usage = require('./utils/usage')
    8 
    9 bugs.usage = usage(
   10   'bugs',
   11   'npm bugs [<pkgname>]'
   12 )
   13 
   14 bugs.completion = function (opts, cb) {
   15   // FIXME: there used to be registry completion here, but it stopped making
   16   // sense somewhere around 50,000 packages on the registry
   17   cb()
   18 }
   19 
   20 function bugs (args, cb) {
   21   var n = args.length ? args[0] : '.'
   22   fetchPackageMetadata(n, '.', function (er, d) {
   23     if (er) return cb(er)
   24 
   25     var url = d.bugs && ((typeof d.bugs === 'string') ? d.bugs : d.bugs.url)
   26     if (!url) {
   27       url = 'https://www.npmjs.org/package/' + d.name
   28     }
   29     log.silly('bugs', 'url', url)
   30     opener(url, { command: npm.config.get('browser') }, cb)
   31   })
   32 }