( command: APICommand, attribute: CapabilityAttribute, name: string, )
| 200 | } |
| 201 | |
| 202 | export const chooseValue = async ( |
| 203 | command: APICommand, |
| 204 | attribute: CapabilityAttribute, |
| 205 | name: string, |
| 206 | ): Promise<string> => { |
| 207 | const values = attribute.schema.properties.value.enum |
| 208 | if (values) { |
| 209 | const config: SelectFromListConfig<CapabilityValueItem> = { |
| 210 | itemName: 'value', |
| 211 | primaryKeyName: 'value', |
| 212 | sortKeyName: 'value', |
| 213 | listTableFieldDefinitions: ['value'], |
| 214 | } |
| 215 | |
| 216 | const listItems = async (): Promise<CapabilityValueItem[]> => Promise.resolve(values.map(value => { |
| 217 | return { value } |
| 218 | })) |
| 219 | |
| 220 | return selectFromList(command, config, { listItems }) |
| 221 | } |
| 222 | return stringInput(`Enter '${name}' attribute value:`) |
| 223 | } |
no test coverage detected