This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

17
node_modules/yargs/lib/usage.js generated vendored
View File

@@ -1,6 +1,7 @@
'use strict'
// this file handles outputting usage instructions,
// failures, etc. keeps logging in one place.
const decamelize = require('./decamelize')
const stringWidth = require('string-width')
const objFilter = require('./obj-filter')
const path = require('path')
@@ -180,7 +181,7 @@ module.exports = function usage (yargs, y18n) {
usages.forEach((usage) => {
ui.div(`${usage[0].replace(/\$0/g, base$0)}`)
if (usage[1]) {
ui.div({text: `${usage[1]}`, padding: [1, 0, 0, 0]})
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] })
}
})
ui.div()
@@ -204,6 +205,10 @@ module.exports = function usage (yargs, y18n) {
const context = yargs.getContext()
const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''
if (yargs.getParserConfiguration()['sort-commands'] === true) {
commands = commands.sort((a, b) => a[0].localeCompare(b[0]))
}
commands.forEach((command) => {
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}` // drop $0 from default commands.
ui.span(
@@ -212,7 +217,7 @@ module.exports = function usage (yargs, y18n) {
padding: [0, 2, 0, 2],
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
},
{text: command[1]}
{ text: command[1] }
)
const hints = []
if (command[2]) hints.push(`[${__('default:').slice(0, -1)}]`) // TODO hacking around i18n here
@@ -220,7 +225,7 @@ module.exports = function usage (yargs, y18n) {
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`)
}
if (hints.length) {
ui.div({text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right'})
ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' })
} else {
ui.div()
}
@@ -296,11 +301,11 @@ module.exports = function usage (yargs, y18n) {
].filter(Boolean).join(' ')
ui.span(
{text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4},
{ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 },
desc
)
if (extra) ui.div({text: extra, padding: [0, 0, 0, 2], align: 'right'})
if (extra) ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' })
else ui.div()
})
@@ -428,7 +433,7 @@ module.exports = function usage (yargs, y18n) {
}
self.functionDescription = (fn) => {
const description = fn.name ? require('decamelize')(fn.name, '-') : __('generated-value')
const description = fn.name ? decamelize(fn.name, '-') : __('generated-value')
return ['(', description, ')'].join('')
}