Code Monkey home page Code Monkey logo

Comments (2)

doowb avatar doowb commented on June 2, 2024

The types provided in prompt-base are intended to be base level prompts that are inherited to build other prompts. They provide some common functionality that's useful for a certain "type" of prompt. boolean, for instance, has the functionality to handle "truthy" and "falsey" values, but it doesn't handle arrow keys because the functionality that occurs when hitting an arrow key is determined by the current value. (e.g. pressing "right arrow" when true, will select false, but when false, will select true).

In the dev branch of enquirer, there are implementations of prompt-confirm and prompt-toggle which use the boolean type. prompt-confirm changes the UI to show Y/n as you pointed out, and prompt-toggle provides additional keypress functionality to handle toggling the value when pressing arrow keys.

If we decide that the arrow key toggling functionality is common enough to include in prompt-confirm, then we could consider moving it to the boolean type. Or, as you mentioned linux and other cli tools... if the right arrow always selects the "falsey" value and the left arrow always selects the "truthy" value, then it might be good to have those in the boolean type, then prompt-confirm will gain that feature.

I hope this clears it up.

from prompt-base.

aloisbarreras avatar aloisbarreras commented on June 2, 2024

Yes that makes total sense, thanks!

from prompt-base.

Related Issues (9)

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.