Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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 1,509 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.