mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
18 lines
544 B
JavaScript
18 lines
544 B
JavaScript
'use strict';
|
|
|
|
const chalk = require('chalk');
|
|
const { style } = require('@serverless/utils/log');
|
|
|
|
module.exports = (commandName, commandSchema, options = {}) => {
|
|
const indentFillLength = 30;
|
|
|
|
const usage = commandSchema.usage;
|
|
if (options.isModern) {
|
|
return `${commandName} ${' '.repeat(
|
|
Math.max(indentFillLength - commandName.length, 0)
|
|
)} ${style.aside(usage)}`;
|
|
}
|
|
const dots = '.'.repeat(Math.max(indentFillLength - commandName.length, 0));
|
|
return `${chalk.yellow(commandName)} ${chalk.dim(dots)} ${usage}`;
|
|
};
|