Giter Site home page Giter Site logo

Comments (5)

SBoudrias avatar SBoudrias commented on August 17, 2024

The older checkbox prompt had a short option to shorten long choices: https://github.com/SBoudrias/Inquirer.js/blob/master/packages/inquirer/lib/prompts/checkbox.js

I don't know we need to keep the same API, but it's an option. Also, if we want to shorten the display, maybe we're better with a rendering function receiving the whole option list (so you could custom format like "a, b and 3 others", etc)

from inquirer.js.

matthyk avatar matthyk commented on August 17, 2024

@SBoudrias Are you open for a PR?

from inquirer.js.

SBoudrias avatar SBoudrias commented on August 17, 2024

Yes, happy to review and merge a PR.

I would recommend us aligning on the right approach to the problem though - want to make sure you don't waste your time if we end up feeling a different API would cover more cases!

from inquirer.js.

matthyk avatar matthyk commented on August 17, 2024

I would go with your second option, to provide a rendering function. I think it is the most flexible option. We could provide the rendering function with the list of all options AND the list of all selected options. Something like:

type RenderFn = (choices: ReadonlyArray<Choice<Value> | Separator>, selectedChoices: ReadonlyArray<Choice<Value>>) => string

But I'm open to everything.

from inquirer.js.

SBoudrias avatar SBoudrias commented on August 17, 2024

Yeah, that works. I like it - it's probably the most flexible option.

Just a nit that I'd flip the function params for all choices and selected choices.

from inquirer.js.

Related Issues (20)

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.