
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
inquirer-form-prompt
Advanced tools
A prompt for inquirer that presents a form with multiple fields and form-like interaction
pnpm add inquirer-form-prompt
yarn add inquirer-form-prompt
npm add inquirer-form-prompt
At minimum, the prompt config must include message: string
and fields: Array<Field>
Example:
import form from 'inquirer-form-prompt'
const answer = await form({
message: 'Trip Details',
fields: [
{
label: 'Full name',
type: 'text',
},
{
label: 'Transport type',
type: 'radio',
choices: ['Train', 'Flight', 'Bus'],
value: 'Train',
},
{
label: 'Activities',
type: 'checkbox',
choices: ['Museums', 'Local Cuisine', 'Historical Sites', 'Nightlife', 'Nature & Parks'],
value: ['Museums', 'Local Cuisine'],
description: 'What activities interest you most? (Select all that apply)',
},
],
})
[!tip] See
src/demo.ts
for a more thorough example.
All fields take the following properties:
label: string // The input field's label
description?: string // Help text that will appear when the field is focused
Use this field for strings, numbers, and free entry. Users may also paste from the clipboard when this field is focused.
type: 'text'
value?: string // Optional default value
Example:
{
label: 'Full name',
type: 'text',
description: 'As it appears on your passport'
}
Use this field for true-or-false entry.
The left and right arrow keys move between the two options. Pressing the spacebar selects or deselects that option.
type: 'boolean'
value?: boolean // Optional default value
Example:
{
label: 'Do you need a visa?',
type: 'boolean',
}
Use this field when the user must choose exactly one option.
The left and right arrow keys move the selection.
type: 'radio'
choices: Array<string>
value?: boolean // Optional default value, must match one of the choices
Example:
{
label: 'Age group',
type: 'radio',
choices: ['0-25', '26-50', '51-75', '76-100']
description: 'In years, on the first day of travel'
}
Use this field when the user may choose multiple options.
The left and right arrow keys move between options. Pressing the spacebar selects or deselects an option. When the form is submitted, only the selected values will be returned.
type: 'checkbox'
choices: Array<string>
value?: Array<string> // Optional default value, each string must match one of the choices
Example:
{
label: 'Activities of Interest',
type: 'checkbox',
choices: ['Museums & Art', 'Local Cuisine', 'Historical Sites', 'Nightlife', 'Nature & Parks'],
value: ['Museums & Art', 'Local Cuisine'],
}
Fields may be split into groups by placing separators between them in the fields
array. See examples below.
The config object accepts a theme
prop which can be used to specify a variant.
theme?: {
variant: 'table' | 'label-top'
dense?: boolean
}
This is the default theme. Each field label and input is displayed in a table row. If a separator is included, it will split the fields into separate tables.
In this example, "Trip Details" and "Preferences" are both separators:
With this variant, the label is displayed above the input field. If a separator is included, it will split the fields into separate tables.
This variant also supports a dense
option which removes some of the extra spacing around the fields:
theme: {
variant: 'label-top',
dense: true
}
FAQs
Form-like, multi-input prompt for Inquirer.js
We found that inquirer-form-prompt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.