"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/utils/usage.js" (11 Apr 2017, 576 Bytes) of package /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 'use strict'
    2 var aliases = require('../config/cmd-list').aliases
    3 
    4 module.exports = function usage (cmd, txt, opt) {
    5   var post = Object.keys(aliases).reduce(function (p, c) {
    6     var val = aliases[c]
    7     if (val !== cmd) return p
    8     return p.concat(c)
    9   }, [])
   10 
   11   if (opt || post.length > 0) txt += '\n\n'
   12 
   13   if (post.length === 1) {
   14     txt += 'alias: '
   15     txt += post.join(', ')
   16   } else if (post.length > 1) {
   17     txt += 'aliases: '
   18     txt += post.join(', ')
   19   }
   20 
   21   if (opt) {
   22     if (post.length > 0) txt += '\n'
   23     txt += 'common options: ' + opt
   24   }
   25 
   26   return txt
   27 }