MCPcopy Create free account
hub / github.com/smapiot/piral / details

Function details

tools/generate-command-docs.js:212–237  ·  view source on GitHub ↗
(command, args)

Source from the content-addressed store, hash-verified

210}
211
212function details(command, args) {
213 if (args.length === 0) {
214 return 'Not applicable.';
215 }
216
217 return args
218 .map(
219 (arg) => `### \`${arg.name}\`
220
221${arg.describe || 'No description available.'}
222
223${
224 !arg.alts || arg.alts.length === 0 ? '' : `- Aliases: \`${arg.alts.map((m) => `--${m}`).join('`, `')}\`${nl}`
225}- Type: \`${arg.type}\`${arg.values ? nl + `- Choices: \`${arg.values.join('`, `')}\`` : ''}
226- Default: \`${arg.default}\`${arg.required ? nl + '- **Caution: This flag is required!**' : ''}${
227 Array.isArray(arg.examples) && arg.examples.length > 0
228 ? `
229
230Examples:
231
232${arg.examples.map((example) => shell(`${getCall(command)} ${example}`)).join(nl + nl)}`
233 : ''
234}`,
235 )
236 .join(nl + nl);
237}
238
239function generateValidator(validator) {
240 return `### \`${validator.name}\`

Callers 1

generateBodyFunction · 0.85

Calls 3

shellFunction · 0.85
getCallFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected