1.4.2 • Published 1 year ago

inquirer-checkbox-plus-prompt v1.4.2

Weekly downloads
19,335
License
MIT
Repository
github
Last release
1 year ago

Inquirer Checkbox Plus Prompt

A plugin for Inquirer, similar to the original checkbox with extra features.

npm npm

Installation

npm install inquirer-checkbox-plus-prompt

Usage

You can name it with any name other than checkbox-plus, just change the string 'checkbox-plus' to anything else.

inquirer.registerPrompt('checkbox-plus', require('inquirer-checkbox-plus-prompt'));

inquirer.prompt({
  type: 'checkbox-plus',
  ...
})

Options

Takes type, name, message, source, filter, validate, default, pageSize, highlight, searchable properties.

The extra options that this plugin provides are:

  • source: (Function) a method that called to return a promise that should be resolved with a list of choices in a similar format as the choices option in the original checkbox prompt of Inquirer.
  • highlight: (Boolean) if true, the current selected choice gets highlighted. Default: false.
  • searchable: (Boolean) if true, allow the user to filter the list. The source function gets called everytime the search query is changed. Default: false.

Example

Check example.js for a more advanced example.

var inquirer = require('inquirer');
var fuzzy = require('fuzzy');

inquirer.registerPrompt('checkbox-plus', require('./index'));

var 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: function(answersSoFar, input) {

    input = input || '';

    return new Promise(function(resolve) {

      var fuzzyResult = fuzzy.filter(input, colors);

      var data = fuzzyResult.map(function(element) {
        return element.original;
      });

      resolve(data);
      
    });

  }
}]).then(function(answers) {

  console.log(answers.colors);

});

License

This project is under the MIT license.

@harvestr-api/cli@lawliet07/sipjsokty-cli@infinitebrahmanuniverse/nolb-inqplop-pack-gatsby-starterplop-pack-sanity-startersoapy-dlsoapy-dl-beta@everything-registry/sub-chunk-1916@ezpaarse-project/ezmesure-adminnode-lissmtg-toolsnextg@kalamazoo/build-utils@gaelmotte/gmotte-sfdx-plugin@fontoxml/fontoxml-development-tools-module-editorpackage-json-cli-editor@guimini/guimini-sfdx-plugin@hideyuki-hori/filch@hash-bang/pssnotumreact-prime@linkapi.solutions/cli@linkapi.solutions/linkapi-clirc-apps-cli@jupiterone/integration-sdk-clipostman-runner@inst-cli/template-utils@inst-pkg/template-utilspoeclirnbuilderrigel-cli@norah1to/setup-cliselect-run@orca-fe/deye-clisequelize-inquirer@polite/clisimpleenshotgrid-nodejs-cli@prius/infrasip-clisolidity-ts-syncrepo-health-cliremove-stale-branchessaua-class-picker@penubo/qst@rocket.chat/apps-cli@zalastax/nolb-inqbojc-extract@after-work.js/interactive-pluginbjira@parken/parken-bootstrapper@parken/parken-generatorremove-aws-resources@mrsimpson/rc-apps-cli@smartcloudai/cli@splunk/dashpub@splunkdlt/udfpub@art-suite/art-prompt-for@atlaskit/build-utilscli-cm-export-to-csv-abhnv@bandzkicks/juicedmonitor-cliapp-to-addon-migratorwqh-clianonymize-excelyin-cliautobahn-corewfe-clianglo-helpercbstodd-cli@baby-cli/sharedaua-class-pickerzipt@albertoxamin/datadog-ci@ancademy/bespoke-cli@ancademy/bespoke-help@ancademy/elf-cli@ancademy/vse-cliadapt-setupadd-gitignore@sujaykumarh/startsvsbank-cli@usekits/cliumi-code-cliumi-plugin-mpa-pug@uidu/build-utils@volks/worldbank-cli@wwselleck/bolt-interactivetestsha-cm-export-to-csvts-refactor@contentstack/cli-cm-export-to-csvcyrun@danny101201/templatescreate-test-app-jata@datadog/datadog-cihulu-clijira-consoledepot-librarydeva-cli
1.4.2

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.0.1

6 years ago

1.0.0

6 years ago