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

Function requireInput

packages/cli/src/exportInput.ts:174–193  ·  view source on GitHub ↗

* Fetch the input name that the user wants to export. * @param inputName - The name of the input to load. * @returns

(inputName?: string)

Source from the content-addressed store, hash-verified

172 * @returns
173 */
174async function requireInput(inputName?: string): Promise<string> | never {
175 if (!inputName) {
176 const res = await prompts({
177 type: 'autocomplete',
178 name: 'inputName',
179 message: 'What input do you want to export?',
180 choices: Object.keys(inputs).map((i) => ({
181 title: i,
182 value: i,
183 })),
184 })
185 inputName = res.inputName
186 }
187 if (!inputName || !(inputName in inputs)) {
188 error(
189 `Cannot export “${inputName}” because it is not part of the @formkit/inputs package.`
190 )
191 }
192 return inputName
193}
194
195/**
196 * Loads the string data of an input that should be exported.

Callers 1

exportInputFunction · 0.85

Calls 1

errorFunction · 0.90

Tested by

no test coverage detected