SBoudrias / Inquirer.js

A collection of common interactive command line user interfaces.
MIT License
20.29k stars 1.3k forks source link

auto-complete list #225

Closed andrewdeandrade closed 7 years ago

andrewdeandrade commented 9 years ago

It would be super nice to have an autocomplete list input type which is a hybrid of the input and list input types. Having it be capable of async (so you can make remote requests and redraw the filtered options in the terminal) would be a plus.

(cc: @lxe)

yangchenyun commented 9 years ago

+1

yangchenyun commented 9 years ago

Hi SBoudrias@, I notice that you are also author of this awesome repo!

How much work do you evaluate to implement this feature? If this is within reasonable time, I could implement it and send you PR for review.

SBoudrias commented 9 years ago

I think it'd be fairly simple. A couple hours at most, but it might be more since you might need to get used to the core principles - and the core of Inquirer date from ~2 years ago, so it's not the cleanest code I've written out there.

yangchenyun commented 9 years ago

Wow, I didn't know this almost 2 years old! So far this is most friendly module to work with terminal app.

Could you point me to some main abstractions you have defined in the core to help me start:

SBoudrias commented 9 years ago

Oh, I think the public API is fairly simple and pretty feature complete. I was more thinking of the behind the scenes abstractions who're bloated around classes. Redoing the core code today, most of this would be in functional style as a lot of class base abstraction currently in use are not needed. But you should be able to wrap your head around it.

I think the list prompt implementation is the most similar to the suggested kind of prompt: https://github.com/SBoudrias/Inquirer.js/blob/master/lib/prompts/list.js

We use RxJS to handle user inputs https://github.com/SBoudrias/Inquirer.js/blob/master/lib/prompts/list.js#L65-L69

Then you just react to those events by writing and clearing the terminal with the new layout.

btakita commented 8 years ago

is this still in the works?

--- edit

it looks like there's an autocomplete plugin https://github.com/mokkabonna/inquirer-autocomplete-prompt

patrick-motard commented 7 years ago

Is this request different from https://github.com/SBoudrias/Inquirer.js/pull/265, the auto-complete prompt? If so, should this be closed?

SBoudrias commented 7 years ago

Right this is now published as a standalone plugin https://github.com/mokkabonna/inquirer-autocomplete-prompt

SBoudrias commented 4 months ago

Maybe of interest, PR open to include such a prompt in the core https://github.com/SBoudrias/Inquirer.js/pull/1479