serverless
Version:
Serverless Framework - Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more
21 lines (15 loc) • 763 B
JavaScript
;
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) process.stdout.write(`${generateCommandUsage(commandName, commandSchema)}\n`);
for (const [subCommandName, subCommandSchema] of commandsSchema) {
if (!subCommandName.startsWith(`${commandName} `)) continue;
process.stdout.write(`${generateCommandUsage(subCommandName, subCommandSchema)}\n`);
}
if (commandSchema) renderOptionsHelp(Object.assign({}, commandSchema.options));
process.stdout.write('\n');
};