mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
24 lines
778 B
JavaScript
24 lines
778 B
JavaScript
'use strict';
|
|
|
|
const { writeText } = require('@serverless/utils/log');
|
|
const resolveInput = require('../resolve-input');
|
|
const renderOptionsHelp = require('./options');
|
|
|
|
const generateCommandUsage = require('./generate-command-usage');
|
|
|
|
module.exports = (commandName) => {
|
|
const { commandsSchema } = resolveInput();
|
|
const commandSchema = commandsSchema.get(commandName);
|
|
|
|
if (commandSchema) {
|
|
writeText(generateCommandUsage(commandName, commandSchema));
|
|
}
|
|
for (const [subCommandName, subCommandSchema] of commandsSchema) {
|
|
if (!subCommandName.startsWith(`${commandName} `)) continue;
|
|
writeText(generateCommandUsage(subCommandName, subCommandSchema));
|
|
}
|
|
if (commandSchema) renderOptionsHelp(Object.assign({}, commandSchema.options));
|
|
|
|
writeText();
|
|
};
|