Git Product home page Git Product logo

inquirer-autocomplete-prompt's Introduction

inquirer-autocomplete-standalone

Standalone autocomplete prompt for the CLI based on inquirer core.

Allows you to show dynamic choices in a list based on user input, both synchronous or asynchronous, allowing you to connect to an external service.

Installation

npm install inquirer-autocomplete-standalone

This is a native ES module package. If you are using it with commonjs you need to import it like this:

async function main() {
  const { default: autocomplete, Separator } = await import(
    'inquirer-autocomplete-standalone'
  );
  const answer = await autocomplete({});
}

main();

If you are using it with typescript see here for examples of how to use it if emitting commonjs or esm from your typescript.

If you want the legacy version used with inquirer version 9 and below then that is located here and can be installed with:

npm install inquirer-autocomplete-prompt

That version will still be maintained for bugs and other issues, but is not the recommended way to use this prompt. This is following the change that Inquirer itself chose. Now the preferred way is to have standalone prompts that you can pick and choose from.

Demo

Run a quick demo locally with

npx inquirer-autocomplete-demo

Usage

import autocomplete from 'inquirer-autocomplete-standalone';
import { searchCountries } = './some-external-api';

const answer = await autocomplete({
  message: 'Travel from what country?',
  source: async (input) => {
    const filteredCountries = await searchCountries(input)
    return filteredCountries.map(country => {
      return {
        value: country,
        description: `${country} is a great place to visit`
      }
    })
  }
})

// user searches and selects a country from the returned list
console.log(answer) // Norway

Example render

Options

The generic type Value is whatever type the value of your choices are.

Property Type Required Description
message string yes The question to ask
source (input?: string) => Promise<Choice<Value> | Separator> | Choice<Value> | Separator yes A function that will be called first once with undefined at the start. Then later with whatever value the user has typed. See table below for full description of the Choice<Value> type. Can also return choices synchronous.
transformer (string, { isFinal: boolean }) => string no Transform/Format the raw value entered by the user. Once the prompt is completed, isFinal will be true. This function is purely visual, modify the answer in your code if needed.
validate (value: Value) => boolean | string | Promise<string | boolean> no On submit, validate the filtered answered content. When returning a string, it'll be used as the error message displayed to the user. Note: returning a rejected promise, we'll assume a code error happened and crash.
default string no If suggestOnly is true: will select that value if pressing enter and no input. If false: will select the choice with this value in the list when source resolves.
emptyText string no The text shown if the source function returns no results. Default: No results...
pageSize number no By default, lists of choice longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once.
searchText string no The text shown when the promise is pending. Default: Searching...
suggestOnly boolean no Default false. If false you must select one of the supplied choices in the list. You select by pressing enter. If true, pressing enter will select any text currently entered, regardless if of what is selected in the list. To choose one of the choices in the list, press tab to make your input the value of that choice.

Choice type and description

type Choice<Value> = {
  value: Value;
  name?: string;
  description?: string;
  disabled?: boolean | string;
};
Property Type Required Description
value any yes The value that will be returned from the prompt when the question has been answered. Should be string if name is absent. If not it is stringified for display.
name string no The text to display for the choice.
description string no Any extra description to show below the list when that choice is selected.
disabled boolean | string no Set to false to disable the choice for selection and to a string to disable it but with a custom text.

Separator

You can also render any Separator to group choices.

import autocomplete, { Separator } from 'inquirer-autocomplete-standalone';

const answer = await autocomplete({
  message: 'Travel from what country?',
  source: async (input) => {
    return [
      new Separator('Africa'),
      new Separator(),
      {
        value: 'Egypt',
      },
      new Separator('Europe'),
      new Separator(),
      {
        value: 'Norway',
      },
    ];
  },
});
? Travel from what country? (Use arrow keys or type to search)
 Africa
 ──────────────
❯ Egypt
 Europe
 ──────────────
  Norway

Credits

Martin Hansen

License

ISC

inquirer-autocomplete-prompt's People

Contributors

alexathome avatar arihant2math avatar denisgorbachev avatar dependabot[bot] avatar derhuerst avatar francoischalifour avatar funkybunky avatar gpittarelli avatar greenkeeper[bot] avatar janslow avatar karlhorky avatar merceyz avatar mhkeller avatar mokkabonna avatar plageoj avatar rafakato avatar raymondfeng avatar rizzlesauce avatar ruyadorno avatar saadfrhan avatar shanejonas avatar sullof avatar xhmikosr avatar ycmjason avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

inquirer-autocomplete-prompt's Issues

`alwaysValidate` override?

I have a use-case for an attribute that I'd like to contribute, but before I do I'm curious if it's something you'd be open to accepting:

New property: alwaysValidate: boolean (default: false)

Generically speaking, there's something to be said for forcing validation, even if the list is limited. To keep inquirer's pizza example, what if the Pizza API has an ingredients API, but a separate one to confirm whether they have an ingredient in supply?

In my use-case, I want to scaffold a test for a component. I do a glob for component files in the project to prepopulate the list, but then have to do some poking around to see if there's a test already maybe (we have some non-standard locations so I have to brute-force it a bit).

I can write the code & tests myself and submit a PR, but I thought it prudent to gauge interest first :).

Split source parameter into two functions

At the moment, the source parameter is a function that takes in two parameters: answers and input

That means that if I want to use answers to decide which choices are available and input to sort them, I have to do it like this:

source: (answers, input) => {
    const choices = getChoicesFromAnswers(answers);

    return filterChoices(choices, input);
}

There is no way to set this up so that getChoicesFromAnswers doesn't get called every time input changes (without implementing caching myself)

It would be nice to have it split into two functions, the first takes in answers and returns another function which takes in input, the result of which is the filtering

source: (answers) => {
    const choices = getChoicesFromAnswers(answers);
   
    return (input) => filterChoices(choices, input);
}

That way getChoicesFromAnswers isn't called every time input changes

Update rxjs to the same version as the latest inquirer

Currently the version of rxjs used in this project is the same as inquirer 6.x. This doesn't allow flattening of deps if one is using the latest inquirer 8.x. And, unfortunately, rxjs is a huge dependency with ~3K files :/ https://packagephobia.com/result?p=rxjs%406.6.7%2Crxjs%407.5.2

Could you update to the latest version please? Or even better, see if you could drop/replace rxjs? If you manage to drop/replace it, it doesn't even need to be a major version.

Thanks!

transformer option not working

Default inquirer transformer option is not working with this plugin. Looking at the sources, it looks like it is not handled at all.

Is there an alternative way to transform the data returned by the source?

Filter value not applied to UI

Hello, me again :D

So the recent filter update you made works great, thanks again for adding that! In default inquirer prompts, if you supply a filter, that filter value will become the answer in the UI.

I've provided a gif to make it easier to explain what I mean. Notice the default input type prompt's display answer is converted to ab even though abc123 was entered. However in the autocomplete prompt the answer value is not changed even though a filter is supplied. The filter for both prompts is simply: answer.slice(0, 2).

autocomplete-bug

No coverage files found

Tests fail because istanbul has no coverage files

No coverage information was collected, exit without writing coverage information

> [email protected] posttest /Users/mike/wrk/test/inquirer-autocomplete-prompt
> istanbul check-coverage --statements 85 --branches 70 --functions 100 --lines 90 && rm -rf coverage


/Users/mike/wrk/test/inquirer-autocomplete-prompt/node_modules/istanbul/lib/cli.js:38
        throw ex; // turn it into an uncaught exception
              ^
ERROR: No coverage files found.
npm ERR! Test failed.  See above for more details.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

please add prefix and suffix in base.js file.

Hello mokkabonna
i am using this module and found an issue. Prefix and suffix is missing from base.js file. i am using inquirer which is supporting prefix and suffix and was presuming that this module is using inquirer as it is as dependency but i was wrong i have gone through the files and manually added prefix and suffix in my local node_module.

this.opt = _.defaults(_.clone(question), {
    validate: function () {
      return true;
    },
    filter: function (val) {
      return val;
    },
    when: function () {
      return true;
    },
    suffix: '',
    prefix: chalk.green('?')
 });

Prompt.prototype.getQuestion = function () {
  var message = this.opt.prefix + ' ' + chalk.bold(this.opt.message)  + this.opt.suffix + chalk.reset(' ');
.......
}

No multi-item autocomplete

I don't see a way to autocomplete multiple items. For instance, if I wanted a user to be able to tab-autocomplete multiple inputs on the same line, each separated by a comma (e.g.,my-selection-1, my-selection-2).

Is this a feature that is going to be added in the future?

Support inquirer v9

Attempting to update my project deps from inquirer v8.2.4 to v9.0.2, I encounter this error.

$ npm update
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/inquirer
npm ERR!   dev inquirer@"^9.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer inquirer@"^8.0.0" from [email protected]
npm ERR! node_modules/inquirer-autocomplete-prompt
npm ERR!   dev inquirer-autocomplete-prompt@"2.0.0" from the root project

Support for inquirer@7

Hey! 👋
Thanks for building & maintaining inquirer-autocomplete-prompt!

We've been using inquirer-autocomplete-prompt in our project ClearTax/pivotal-flow with [email protected] for a while now without any issues (as per our use case).

Just wondering if there are any plans to support that version officially in inquirer-autocomplete-prompt - since it keeps showing peer dependency warnings.

Add inquirer as peer dependency

Why don't we mention inquirer as a peer dependency in this project rather than using it as a dependency?

Also, can we upgrade inquirer to version 5.1.0

Can the default input value be undefined instead of null?

Thanks for a great plugin! Really enjoy it.

I got tripped up with the default value of the input parameter of the source function.

const exampleSearch = async (answers, input = "") => {
  // since `null` is passed to input, default parameters won't work here
}

I see in your example you are doing something like input = input || "" but I was curious if the value can be undefined and work just as well. This would allow for default parameters to work instead of overloading the parameter on the first line of the function.

Filter is not applied to answer

filter is not applied to the selected value / answer. To reproduce adjust your example.js file prompts to:

{
  type: 'autocomplete',
  name: 'fruit',
  suggestOnly: true,
  message: 'What is your favorite fruit?',
  source: searchFood,
  pageSize: 4,
  filter: answer => answer.slice(0, 2),
  validate: function(val) {
    return val ? true : 'Type something!';
  },
}, {
  type: 'autocomplete',
  name: 'state',
  message: 'Select a state to travel from',
  source: searchStates,
  filter: answer => answer.slice(0, 2),
},

Notice the values remain unchained.

Feature Request: support multiple choices

It is common to select multiple items in 'choices'; an idea will be to modify the 'onSubmit' callback and distinguish between an action to pick current selected item and an action to continue to next prompt.

TypeError: thisPromise.then is not a function

Code

const inquirer = require('inquirer')
const autocomplete = require('inquirer-autocomplete-prompt')

const array = ['red', 'green', 'blue', 'yellow']

inquirer.registerPrompt('autocomplete', autocomplete)
inquirer.prompt({
  type: 'autocomplete',
  name: 'server',
  message: 'Select a server to sync mods with',
  source: (answersSoFar, input) => {
    return array.filter(e => e.startsWith(input))
  },
})

process.on('unhandledRejection', err => console.log(err))

Error

TypeError: thisPromise.then is not a function
    at Prompt.search (D:\Yuta\Desktop\node_modules\inquirer-autocomplete-prompt\index.js:186:22)
    at Prompt._run (D:\Yuta\Desktop\node_modules\inquirer-autocomplete-prompt\index.js:71:8)
    at Prompt.<anonymous> (D:\Yuta\Desktop\node_modules\inquirer-autocomplete-prompt\node_modules\inquirer\lib\prompts\base.js:56:10)
    at new Promise (<anonymous>)
    at Prompt.run (D:\Yuta\Desktop\node_modules\inquirer-autocomplete-prompt\node_modules\inquirer\lib\prompts\base.js:55:10)
    at DeferSubscriber.Rx.Observable.defer [as factory] (D:\Yuta\Desktop\node_modules\inquirer\lib\ui\prompt.js:84:27)
    at DeferSubscriber._callFactory (D:\Yuta\Desktop\node_modules\rxjs\observable\DeferObservable.js:92:27)
    at DeferSubscriber.tryDefer (D:\Yuta\Desktop\node_modules\rxjs\observable\DeferObservable.js:85:18)
    at new DeferSubscriber (D:\Yuta\Desktop\node_modules\rxjs\observable\DeferObservable.js:81:14)
    at DeferObservable._subscribe (D:\Yuta\Desktop\node_modules\rxjs\observable\DeferObservable.js:71:16)

Better support for default value

Hello, first off, thanks you so much for your very good library. I'm having some minor troubles with default values.

Description

I have to make database searches with autocomplete for user.
I want the autocomplete to return me an id, but to search by username, so I have to carry an object with {name, value}, which already works great.

The problem arises when I want to select a default user.

Code

async function issueWithDefault(){

    const inquirer = require("inquirer");
    inquirer.registerPrompt(
      "autocomplete",
      require("inquirer-autocomplete-prompt")
    );

    const dummyDB = [
        {username:"joe",_id:1},
        {username:"mikael",_id:2},
        {username:"roy",_id:3},
        {username:"dennis",_id:4},
        {username:"edward",_id:5},
        {username:"john",_id:6},
        {username:"michelle",_id:7},
        {username:"johnatan",_id:8},
    ];


    //Search dummyDB, returns list of {name,value}.
    const source = async function(answersSoFar,input){
          const user =  await dummyDB.filter(u => new RegExp(".*"+input+".*").exec(u.username))
          return user.map(u=>({name:u.username,value:u._id}))
    }

    const promptObj = {
        type: "autocomplete",
        default:4,
        name: "user",
        message: "Type a username",
        source: source
      }

     const rslt = await inquirer.prompt([promptObj]);

     console.log(rslt);
}

issueWithDefault();

The prompt shows the id, not the username (which is expected since I only entered the id as a default value, see code above, default:4).

? Type a username (4) (Use arrow keys or type to search)
  No results...

Proposal

The default should be able to take an object with {value, name} keys so that prompt will be able to show the username instead of an ID.

    const promptObj = {
        type: "autocomplete",
        default:{name:"dennis",value:4},
        name: "user",
        message: "Type a username",
        source: source
      }

Current behaviour

? Type a username ([object Object]) (Use arrow keys or type to search)
  No results...

Expected behaviour

? Type a username (dennis) (Use arrow keys or type to search)
  No results...

Regarding initial search string as `null`

Thank you very much for building this amazing tool!

I find it weird that the initial search string being passed to source is set to null. I think it would make more sense if '' is passed. Is there any philosophy behind this decision?

Would be happy to submit a pull request to change this.

No reaction on Windows 10 console.

Hi,

I'm really interested in this plugin. I also just discovered inquirer, so I'm not very experienced with it.
I do know that the question type "list" works fine. But autocomplete doesn't show any reaction. I can't input any text nor can I select values from the list. The initial content of the list works fine though.

I've created this little test script:

'use strict';

const inquirer = require('inquirer');
inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));

inquirer.prompt([
    {
        type: 'autocomplete',
        name: 'first',
        message: 'What do you want to do?',
        source: (answers, input) => {
            return new Promise((resolve, reject) => {
                resolve([input + ' 1', input + ' 2', input + ' 3']);
            });
        }
    }
], answers => {
    console.log(JSON.stringify(answers));
});

When I start it I get the output, which is fine obviously:

? What do you want to do? (Use arrow keys or type to search)
> null 1
  null 2
  null 3

But after showing the question the script basically "freezes". I can accept the first entry with enter or stop it with Ctrl + C.

Returns empty answers with fuzzy object search

Hi I am doing like this, but it answers returns empty string

function searchUser(answers, input) {
var names = [ { name: "Test1", accountId: "a746hsjikel" }, { name: "Test2", accountId: "982bjkkgkbnd" } ]
return new Promise(function(resolve) {
    setTimeout(function() {
      var options = {
        extract: function(el) {
          return el.name;
        }
      };
      var fuzzyResult = fuzzy.filter(input, names, options);
      resolve(
        fuzzyResult.map(function(el) {
          return el.string;
        })
      );
    }, 2000);
  });
}

inquirer
  .prompt([
    {
      type: "autocomplete",
      name: "test",
      message: "Search user",
      source: searchUsers,
      pageSize: 4,
      suggestOnly: true
    }
  ])
  .then(function(answers) {
    console.log(JSON.stringify(answers, null, 2));
  }); 

Could not find a declaration file for module 'inquirer-autocomplete-prompt

inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'))

I get this error in the editor: "Could not find a declaration file for module 'inquirer-autocomplete-prompt'. '/Users/lando/Documents/Code/nt-cli/node_modules/inquirer-autocomplete-prompt/index.js' implicitly has an 'any' type."

When I try to run my inquirer script, it works up until I get to the autocomplete prompt then hangs.

`
const inquirer = require('inquirer')
var _ = require('lodash')
inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'))
var foods = ['Apple', 'Orange', 'Banana', 'Kiwi', 'Lichi', 'Grapefruit'];

function searchFood(answers, input) {
input = input || ''
return new Promise(function(resolve) {
setTimeout(function() {
var fuzzyResult = fuzzy.filter(input, foods)
resolve(
fuzzyResult.map(function(el) {
return el.original
})
)
}, _.random(30, 500))
})
}

program
.command('add')
.alias('a')
.action(() => {
inquirer
.prompt([
{
message: 'What is the note name?',
type: 'input',
name: 'name',
validate: function checkForDuplicates(name) {
return Note.findOne({name : name})
.then(note => note ? 'Note already exists' : true)
},
},
{
message: 'Please enter the content',
type: 'input',
name: 'content',
},
{
type: 'autocomplete',
name: 'fruit',
suggestOnly: true,
message: 'What is your favorite fruit?',
source: searchFood,
pageSize: 4,
validate: function(val) {
return val ? true : 'Type something!'
},
},
])`

validate value is empty

{
    type: 'autocomplete',
    name: 'name',
    message: 'which do you choose?',
    source: (answersSoFar, input) => search(input),
    suggestOnly: true,
    validate: value => console.log(value)
}

using

    "inquirer-autocomplete-prompt": "^0.11.0",

value passed to validate is empty, search is async.

It would also be nice if I could validate an input even when suggestOnly is false. There are times when I want to check async things and the validate step is the most appropriate place to do it.

Pagination

Off the top of your head, do you know if it would be possible to implement pagination when the user scrolls down far enough in the search results? Or is it impossible to get notified by inquirer that that's happened?

I want to make helpers for selecting AWS resources, and it would be nice to be able to use AWS pagination.

On the other hand, I want to cache and immediately show recent selections while new results are being fetched, which probably isn't possible with this...maybe I should make my own thing that doesn't rely on inquirer...

support 'display' option.

sometimes, we fetch data(a list for object) to auto-complete-select, but which key in each object should to be the "Display Name"?

For Now: I need store the data's key mapping, after user select a item, use regular express to get the key, and get the result. It's too troublesome.

Supporting the name, value, short schema

Often for lists and choices inquirer supports objects containing name, value and short properties for display, resulting value and displayed short value after selection.

It seems like autocomplete only accepts strings currently. I'd like to request the above as a feature.

Error: Cannot find module 'rxjs/operators'

got this error when the module is invoked.

Error: Cannot find module 'rxjs/operators'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object. (/path/to/mypackage/node_modules/inquirer-autocomplete-prompt/index.js:16:21)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)

Feature Request: Support initial search text

I'm currently using a command line api that allows you to pass in a name to identify which projected the user wants to compile, and if the user passes is s as their name argument it's not going to match anything in the exactly but it would reduce the initial list that's displayed if I could pass in an initial option that would be the first thing passed into the source function instead of null

Here's some screenshots of what I'm talking about.

Currently this is what's happening. If the user passes in a name that's not an exact match my app will return throw that warning and run the auto complete prompt, and the list is untouched.

current

Here's what I would like it to look like if there was a initial search term. Where the initial search term was s and it shows the matched results based off of s.

proposed

"No results." on init?

When I launch the example it displays "No results..." as opposed to showing me the list as it used to do. It works as expected in e75ae50 but breaks as of faf4a4c. I tried looking through there to see what might have caused it but didn't see it right away.

TypeError: this.line.substring is not a function

It crashes when I tab on "Tab" button for autocomplete. This is how I works with inquirer modules.

await inquirer.prompt([
  {
      type: "autocomplete",
      name: "product",
      message: `test`,
      suggestOnly: true,
      source: function (ans, input) {
        return new Promise(async function (res) {
          const search = input
            ? await Product.find({
                name: { $regex: new RegExp(input, `i`) },
              }).lean()
            : [];
          const choices = search.map((x) => ({
            name: x.name,
            value: x,
          }));
          res(choices);
        });
      },
    },
]);

image

This error happens when I set value as object to the source function. Once I changed back the value to string, It works fine.

Allow `source` to not be a Promise

You might already have gotten the data before the prompt is created. Instead of forcing me to wrap my results in a promise, it would be nice if you just did: Promise.resolve().then(() => opts.source).

Note, I'm intentionally not suggesting Promise.resolve(opts.source()) as that would not catch any synchronous error.

Right now, I'm doing:

source: (answers, input) => Promise.resolve().then(() => filterProcesses(input, processes))

suggestOnly and backspace to change your mind

Hi, I am seeing a weird behavior using suggestOnly=true.
suppose I start typing and autocomplete returns a list of options, and then I hit <TAB> to pick one. If I decide to change my answer, I have to type <BACKSPACE> several times before it actually starts modifying the live contents of the prompt.

I would expect the desired behavior would be for the live input string to be transformed to the chosen autocomplete value when pressing <TAB>, then upon receiving a <BACKSPACE> to immediately make the live value start erasing the last character.

Accept arbitrary string as input?

I'm looking for an inquirer plugin that would present a list as a starting off point but allow for an arbitrary string if the list doesn't have what the user wants. This module looks like a great starting point. Do you have any guidance on where to tweak it for that behavior?

inquirer.Separator not being rendered

Because of the rotating nature of the selection list, if the list size is greater than pageSize, I'd like to put a separator at the end of my list. Adding new inquirer.Separator() to the choices array works for type "list", but it appears to be omitted in the "autocomplete" version.

Argument Autocomplete

Would be awesome if command arguments could be tab-completed. For example with the command prog.command('install <cms>'), you could specify some options for <cms>, so let's say Wordpress or Drupal, and when I'm typing out the command if I type Wo and press tab then it would autocomplete to Wordpress. Similar to Vorpal's autocomplete

crashes on special keys

Whenever I type something /[^A-Z]/i, it crashes with TypeError: Cannot read property 'name' of undefined.

Is it possible to multiple-select?

I was wondering if this prompt can allow multiple options to be selected
I don't see a mention in the docs about this.

Thanks for this great autocompleter!

[email protected] fails to install with [email protected]

Hello !
Package fails to install after inquirer last update to 8.0.0.

$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/inquirer
npm ERR!   inquirer@"^8.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer inquirer@"^5.0.0 || ^6.0.0 || ^7.0.0" from [email protected]
npm ERR! node_modules/inquirer-autocomplete-prompt
npm ERR!   inquirer-autocomplete-prompt@"^1.3.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.