( framework: Framework, toolchain?: string | false, )
| 237 | } |
| 238 | |
| 239 | export async function selectToolchain( |
| 240 | framework: Framework, |
| 241 | toolchain?: string | false, |
| 242 | ): Promise<string | undefined> { |
| 243 | if (toolchain === false) { |
| 244 | return undefined |
| 245 | } |
| 246 | |
| 247 | const toolchains = new Set<AddOn>() |
| 248 | for (const addOn of framework.getAddOns()) { |
| 249 | if (addOn.type === 'toolchain') { |
| 250 | toolchains.add(addOn) |
| 251 | if (toolchain && addOn.id === toolchain) { |
| 252 | return toolchain |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | const tc = await select({ |
| 258 | message: 'Select toolchain', |
| 259 | options: [ |
| 260 | { |
| 261 | value: undefined, |
| 262 | label: 'None', |
| 263 | }, |
| 264 | ...Array.from(toolchains).map((tc) => ({ |
| 265 | value: tc.id, |
| 266 | label: tc.name, |
| 267 | })), |
| 268 | ], |
| 269 | initialValue: undefined, |
| 270 | }) |
| 271 | |
| 272 | if (isCancel(tc)) { |
| 273 | cancel('Operation cancelled.') |
| 274 | process.exit(0) |
| 275 | } |
| 276 | |
| 277 | return tc |
| 278 | } |
| 279 | |
| 280 | export async function promptForAddOnOptions( |
| 281 | addOnIds: Array<string>, |
no test coverage detected