kit
kit copied to clipboard
Error when using names/values for arg function returned for env
I would like to have a different label and value for the arg function as follows:
let MY_API_USER = await env("MY_API_USER", async () => {
return await arg("Select a user for your API", [
{ name: "John", value: 1 },
{ name: "Mindy", value: 2 },
{ name: "Joy", value: 3 },
]);
});
await div(
md(
`You selected ${MY_API_USER}. Running this script again will remember your choice`
)
);
But if I do this I get an error:
input?.startsWith is not a function
TypeError: input?.startsWith is not a function
at global.env (file:///Users/laurisaarni/.kit/api/global.js:49:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///Users/laurisaarni/.kenv/scripts/choose-an-environment-variable.js
The second argument to env must be a list of Choices. That can be e.g. a string array, or something more complex. Right now, you're passing a number (your value) 1, 2 or 3 as the second argument, which won't work.