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

Function addBasicCommand

src/commands/capabilities/create.ts:122–143  ·  view source on GitHub ↗
(
		capability: CapabilityCreate,
		attribute: CapabilityAttribute,
		commandName: string,
		type: Type,
		value: unknown,
)

Source from the content-addressed store, hash-verified

120}
121
122const addBasicCommand = (
123 capability: CapabilityCreate,
124 attribute: CapabilityAttribute,
125 commandName: string,
126 type: Type,
127 value: unknown,
128): void => {
129 if (!attribute.enumCommands) {
130 attribute.enumCommands = []
131 }
132 attribute.enumCommands.push({ command: commandName, value })
133
134 const capabilityCommand = {
135 name: commandName,
136 arguments: [{
137 name: 'value',
138 optional: false,
139 schema: buildSchemaMatchingAttributeType(attribute, type),
140 }],
141 }
142 addCommand(capability, commandName, capabilityCommand)
143}
144
145const promptAndAddBasicCommands = async (
146 capability: CapabilityCreate,

Callers 1

Calls 2

addCommandFunction · 0.85

Tested by

no test coverage detected