mirror of
https://github.com/nodejs/node.git
synced 2025-05-22 05:46:19 +00:00

PR-URL: https://github.com/nodejs/node/pull/36487 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
30 lines
578 B
JavaScript
30 lines
578 B
JavaScript
var aliases = require('../utils/cmd-list').aliases
|
|
|
|
module.exports = function usage (cmd, txt, opt) {
|
|
var post = Object.keys(aliases).reduce(function (p, c) {
|
|
var val = aliases[c]
|
|
if (val !== cmd)
|
|
return p
|
|
return p.concat(c)
|
|
}, [])
|
|
|
|
if (opt || post.length > 0)
|
|
txt += '\n\n'
|
|
|
|
if (post.length === 1) {
|
|
txt += 'alias: '
|
|
txt += post.join(', ')
|
|
} else if (post.length > 1) {
|
|
txt += 'aliases: '
|
|
txt += post.join(', ')
|
|
}
|
|
|
|
if (opt) {
|
|
if (post.length > 0)
|
|
txt += '\n'
|
|
txt += 'common options: ' + opt
|
|
}
|
|
|
|
return txt
|
|
}
|