MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / buildEpilog

Function buildEpilog

src/lib/help.ts:22–53  ·  view source on GitHub ↗
(options: BuildEpilogOptions)

Source from the content-addressed store, hash-verified

20 formattedNotes?: string
21}
22export const buildEpilog = (options: BuildEpilogOptions): string => {
23 const commandName = options.command.split(' ')[0]
24 const { topics, subCommands } = findTopicsAndSubcommands(commandName)
25
26 const parts: string[] = []
27 if (options.notes || options.formattedNotes) {
28 const notesArray = (typeof options.notes === 'string' ? [options.notes] : [...(options.notes ?? [])])
29 .map(note => ` ${note}`)
30 if (options.formattedNotes) {
31 notesArray.push(options.formattedNotes)
32 }
33 parts.push('Notes:\n' + notesArray.join('\n'))
34 }
35 if (options.apiDocs) {
36 parts.push(apiDocsURL(options.apiDocs))
37 }
38 if (topics.length) {
39 parts.push('Topics:\n' + topics.map(topic => ` ${topic}`).join('\n'))
40 }
41 if (subCommands.length) {
42 const data = subCommands.map(subCommand => [` ${subCommand.relatedName}`, subCommand.command.describe])
43 parts.push('Sub-Commands:\n' + table(data, {
44 border: getBorderCharacters('void'),
45 columnDefault: {
46 paddingLeft: 0,
47 paddingRight: 1,
48 },
49 drawHorizontalLine: () => false,
50 }))
51 }
52 return parts.join('\n\n')
53}

Callers 15

builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85
builderFunction · 0.85

Calls 2

findTopicsAndSubcommandsFunction · 0.85
apiDocsURLFunction · 0.85

Tested by

no test coverage detected