
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
inquirer-ts-checkbox-plus-prompt
Advanced tools
Checkbox with autocomplete and other additions for Inquirer
A plugin for Inquirer, similar to the original checkbox with extra features. This project is TypeScript port from inquirer-checkbox-plus-prompt
npm install -g inquirer-ts-checkbox-plus-prompt
You can name it with any name other than checkbox-plus
, just change the string 'checkbox-plus'
to anything else.
import { CheckboxPlusPrompt } from 'inquirer-ts-checkbox-plus-prompt';
inquirer.registerPrompt('checkbox-plus', CheckboxPlusPrompt);
inquirer.prompt({
type: 'checkbox-plus',
...
})
Takes type
, name
, message
, source
[, filter
, validate
, default
, pageSize
, highlight
, searchable
] properties.
The extra options that this plugin provides are:
choices
option in the original checkbox
prompt of Inquirer
.true
, the current selected choice gets highlighted. Default: false
.true
, allow the user to filter the list. The source
function gets called everytime the search query is changed. Default: false
.Check example.ts for a more advanced example.
import fuzzy from 'fuzzy';
import inquirer from 'inquirer';
import CheckboxPlusPrompt from '../lib/CheckboxPlusPrompt';
inquirer.registerPrompt('checkbox-plus', CheckboxPlusPrompt);
const colors = ['red', 'green', 'blue', 'yellow'];
inquirer
.prompt([
{
type: 'checkbox-plus',
name: 'colors',
message: 'Enter colors',
pageSize: 10,
highlight: true,
searchable: true,
default: ['yellow', 'red'],
source(answersSoFar, input) {
input ||= '';
return new Promise((resolve) => {
const fuzzyResult = fuzzy.filter(input, colors);
const data = fuzzyResult.map((element) => {
return element.original;
});
resolve(data);
});
},
},
])
.then((answers) => {
console.log(answers.colors);
});
This project is under the MIT license.
FAQs
Checkbox with autocomplete and other additions for Inquirer
The npm package inquirer-ts-checkbox-plus-prompt receives a total of 2,573 weekly downloads. As such, inquirer-ts-checkbox-plus-prompt popularity was classified as popular.
We found that inquirer-ts-checkbox-plus-prompt demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.