SBoudrias / Inquirer.js

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

[Feature Request] filterlist #250

Closed robdylan closed 6 years ago

robdylan commented 9 years ago

I'm using an over sized list. I tried to separate entries doing something like:

{
        type: 'list',
        name: 'letter',
        message: 'Entry starts with:',
        choices: [
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
            'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
        ]
}

However I'm not happy with it. A way better way would be to use a list that I can filter though. For example when I hit 'abe' to display only entries that contain 'abe'. Here is an example: http://jsfiddle.net/yL2gLz2e/

Then progress like it is done for list. So the client has the choice to rather continue typing or using the arrow keys to select the entry he wants.

I started to take a look at node.js last week. Doing this myself would pretty much overwhelm me. I think it is a good idea and quite a lot applications would profit from it, when you decide to give it a shot.

SBoudrias commented 9 years ago

Hey, I'm not sure I understand the feature you're describing.

robdylan commented 9 years ago

Like filterlist When I hit enter it get's autocompleted to the entry I've currently selected. When I continue typing and my word is not contained by any entries, display no entries and display an error message. When I delete one letter, filter though 'ab' instead of 'abe'. When I type nothing, display all entries unfiltered.

You could even use your bottom-bar extension displaying '...' when the word to filter is getting updated. But that's not important. I mean this is still a CLI application, no loading animation needed. I mean it is nice, but not as important compared to other things.

I'm glad for any feature that gets closed to it.

robdylan commented 9 years ago

Oh the jsfillde link was broken. Here is a working one: http://jsfiddle.net/yL2gLz2e/

juancoen commented 9 years ago

+1

paoloantinori commented 9 years ago

Hi, I am working on a customization to get the same result:

https://asciinema.org/a/2abz5r1f4sfsahhbl6161nc3f

I'm currently hitting a specific problem: q key closes the app.

I have not been able to understand how to disable this behavior. Any hint?

SBoudrias commented 9 years ago

@paoloantinori Inquirer doesn't close when someone press q. That's something in your own code.

paoloantinori commented 9 years ago

@SBoudrias thank you for pointing that out. I was looking in the wrong place!

robdylan commented 9 years ago

@paoloantinori nice is that published already? :+1:

jonschlinkert commented 9 years ago

this would be great to have.

SBoudrias commented 9 years ago

You guys might be interested in this project https://github.com/mokkabonna/inquirer-autocomplete-prompt

robdylan commented 8 years ago

@paoloantinori Did you publish the application? Was it https://github.com/paoloantinori/git-bc ? https://github.com/search?utf8=%E2%9C%93&q=user%3Apaoloantinori+abc&type=Code&ref=searchresults :|

@SBoudrias https://github.com/mokkabonna/inquirer-autocomplete-prompt/blob/master/example.js doesn't work for me.

I'm still very interested.

the-simian commented 8 years ago

This is a cool feature idea for large sets, I can see its being handy.

GeorgeGkas commented 6 years ago

should we close this issue?