MCPcopy Index your code
hub / github.com/SmartThingsCommunity/smartthings-cli / builder

Function builder

src/commands/apps.ts:38–64  ·  view source on GitHub ↗
(yargs: Argv)

Source from the content-addressed store, hash-verified

36const describe = 'get a specific app or a list of apps'
37
38const builder = (yargs: Argv): Argv<CommandArgs> =>
39 outputItemOrListBuilder(apiCommandBuilder(yargs))
40 .positional('id-or-index', { describe: 'the app id or number from list', type: 'string' })
41 .option('type', {
42 describe: 'filter results by app type',
43 type: 'string',
44 choices: Object.values(AppType),
45 coerce: arg => arg.toUpperCase() as AppType,
46 })
47 .option('classification', {
48 describe: 'filter results by one or more classifications',
49 type: 'string',
50 array: true,
51 choices: Object.values(AppClassification),
52 coerce: arg => arg?.map((str: string) => str.toUpperCase() as AppClassification),
53 })
54 .option('verbose',
55 { alias: 'v', describe: 'include URLs and ARNs in table output', type: 'boolean', default: false })
56 .example([
57 ['$0 apps', 'list all apps'],
58 ['$0 apps 1', 'display details for the first app in the list retrieved by running "smartthings apps"'],
59 ['$0 apps 5dfd6626-ab1d-42da-bb76-90def3153998', 'display details for an app by id'],
60 ['$0 apps --verbose', 'include URLs and ARNs in the output'],
61 ['$0 apps --classification SERVICE', 'list SERVICE classification apps'],
62 ['$0 apps --type API_ONLY', 'list API-only apps'],
63 ])
64 .epilog(buildEpilog({ command, apiDocs: ['listApps', 'getApp'] }))
65
66const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
67 const command = await apiCommand(argv)

Callers 15

devices.test.tsFile · 0.50
locations.test.tsFile · 0.50
config.test.tsFile · 0.50
apps.test.tsFile · 0.50
logout.test.tsFile · 0.50
rules.test.tsFile · 0.50

Calls 2

apiCommandBuilderFunction · 0.85
buildEpilogFunction · 0.85

Tested by

no test coverage detected