MCPcopy Create free account
hub / github.com/TanStack/cli / selectToolchain

Function selectToolchain

packages/cli/src/ui-prompts.ts:239–278  ·  view source on GitHub ↗
(
  framework: Framework,
  toolchain?: string | false,
)

Source from the content-addressed store, hash-verified

237}
238
239export 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
280export async function promptForAddOnOptions(
281 addOnIds: Array<string>,

Callers 2

ui-prompts.test.tsFile · 0.90
promptForCreateOptionsFunction · 0.85

Calls 1

addMethod · 0.80

Tested by

no test coverage detected