mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
21 lines
701 B
JavaScript
21 lines
701 B
JavaScript
import utils from '@serverlessinc/sf-core/src/utils.js'
|
|
import renderOptionsHelp from './options.js'
|
|
import generateCommandUsage from './generate-command-usage.js'
|
|
|
|
const { writeText } = utils
|
|
|
|
export default ({ commandName, commandsSchema }) => {
|
|
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()
|
|
}
|