243
// TODO(@bcoe): why isn't commands[0][2] an object with a named property?
244
if (commands.length > 1 || (commands.length === 1 && !commands[0][2])) {
246
>
247
>
const context = yargs.getInternalMethods().getContext();
248
>
const parentCommands = context.commands.length
249
>
? `${context.commands.join(' ')} `
250
>
: '';
251
>
252
>
if (
253
>
yargs.getInternalMethods().getParserConfiguration()['sort-commands'] ===
254
>
true
255
>
) {
256
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
257
}
259
>
const prefix = base$0 ? `${base$0} ` : '';
260
>
261
>
commands.forEach(command => {
262
>
const commandString = `${prefix}${parentCommands}${command[0].replace(
263
>
/^\$0 ?/,
264
>
''
265
>
)}`; // drop $0 from default commands.
266
>
ui.span(
267
>
{
268
>
text: commandString,
269
>
padding: [0, 2, 0, 2],
270
>
width:
271
>
maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4,
272
>
},
273
>
{text: command[1]}
274
>
);
275
>
const hints = [];
276
>
if (command[2]) hints.push(`[${__('default')}]`);
277
>
if (command[3] && command[3].length) {
278
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
279
}
281
if (typeof command[4] === 'string') {
282
hints.push(`[${__('deprecated: %s', command[4])}]`);