1.4.2 • Published 2 years ago

inquirer-checkbox-plus-prompt v1.4.2

Weekly downloads
19,335
License
MIT
Repository
github
Last release
2 years 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-1916svsbank-cliwfe-cliwqh-clitestsha-cm-export-to-csv@dofu/infra@dream2023/itaro@contentstack/cli-cm-export-to-csvcs-cli-1-cm-export-to-csvjira-consolekggame-cmdsolidity-ts-syncumi-code-cliumi-plugin-mpa-pug@art-suite/art-prompt-for@ancademy/bespoke-cli@ancademy/bespoke-help@ancademy/elf-cli@ancademy/vse-cli@atlaskit/build-utils@albertoxamin/datadog-ci@baby-cli/shared@bandzkicks/juicedmonitor-cli@after-work.js/interactive-plugin@jupiterone/integration-sdk-cli@datadog/datadog-ci@danny101201/templatesyin-clits-refactorzipt@guimini/guimini-sfdx-plugin@hash-bang/pss@hideyuki-hori/filch@em-cli/shared@gaelmotte/gmotte-sfdx-plugin@fontoxml/fontoxml-development-tools-module-editor@inst-cli/template-utils@inst-pkg/template-utils@linkapi.solutions/cli@linkapi.solutions/linkapi-cli@mrsimpson/rc-apps-cli@ezpaarse-project/ezmesure-admin@kalamazoo/build-utils@norah1to/setup-cli@prius/infra@polite/cli@orca-fe/deye-cli@parken/parken-bootstrapper@parken/parken-generator@penubo/qst@smartcloudai/cli@splunk/dashpub@splunkdlt/udfpub@rocket.chat/apps-climtg-toolspackage-json-cli-editorselect-runsequelize-inquirerrnbuilderrc-apps-clisaua-class-pickerremove-aws-resourcesremove-stale-branchesnode-lissnextgnotumpoeclipostman-runnerrepo-health-clirigel-clireact-primeshotgrid-nodejs-clisip-clisimpleengithub-repositories-archiverghogit-genuigit-dlbgithub-managerhulu-cliinitpageh5-serverinquirer-code-promptslint-mclego-seedlvjun-clilvshoulxs-clilwd426mayadbmdi-cli@wwselleck/bolt-interactive
1.4.2

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.0.1

7 years ago

1.0.0

7 years ago