MCPcopy Create free account
hub / github.com/formkit/formkit / requireLang

Function requireLang

packages/cli/src/exportInput.ts:146–167  ·  view source on GitHub ↗

* Determine the language the user wants to export. * @param lang - The language to export the input to. * @returns

(lang?: string)

Source from the content-addressed store, hash-verified

144 * @returns
145 */
146async function requireLang(lang?: string): Promise<string> {
147 if (!lang) {
148 const guessedLang = guessLang()
149 lang = await prompts({
150 type: 'select',
151 name: 'lang',
152 message: 'What language should be used?',
153 choices: [
154 guessedLang === 'ts'
155 ? { title: 'TypeScript', value: 'ts' }
156 : { title: 'JavaScript', value: 'js' },
157 guessedLang === 'ts'
158 ? { title: 'JavaScript', value: 'js' }
159 : { title: 'TypeScript', value: 'ts' },
160 ],
161 }).then((val) => val.lang)
162 if (!lang) {
163 error('No language selected, exiting.')
164 }
165 }
166 return lang
167}
168
169/**
170 * Fetch the input name that the user wants to export.

Callers 1

exportInputFunction · 0.85

Calls 2

errorFunction · 0.90
guessLangFunction · 0.85

Tested by

no test coverage detected