Quick Keys
Quick Keys
A quick key allows you to bind a single key to submit a prompt.
You can add quick keys inside the "hint" if you don't want to bother with choices:
let confirm = await arg({
placeholder: "Eat a taco?",
hint: `[y]es/[n]o`,
})
console.log(confirm)
Otherwise, add the quick keys in the name
of the choices and it will return the quick key:
let fruit = await arg(`Pick one`, [
`An [a]pple`,
`A [b]anana`,
`a [g]rape`,
])
console.log(fruit)
You can add a value, then typing the quick key will return the value:
let vegetable = await arg("Pick a veggie", [
{ name: "[C]elery", value: "Celery" },
{ name: "C[a]rrot", value: "Carrot" },
])
console.log(vegetable)