Git Product home page Git Product logo

Comments (8)

KarolosLykos avatar KarolosLykos commented on May 24, 2024

@elfrucool I've added a draft that includes this new functionality. Would you like to take a look and offer some feedback?

from pterm.

elfrucool avatar elfrucool commented on May 24, 2024

I'll take a look once I get a moment

from pterm.

KarolosLykos avatar KarolosLykos commented on May 24, 2024

Thanks for the feedback! I understand your point. Although, in situations where pressing Enter is associated with confirmation, it might be confusing if the default action is "No" or "Cancel".

Also, most CLI prompts don't include a "confirmation helper text", so it might not be necessary here.

In my view, removing the helper text seems like the better option. However, let's wait for the maintainers to decide if they prefer your suggestion (adds more complexity to the printer) or if it's best to remove "confirmation helper text" altogether.

from pterm.

KarolosLykos avatar KarolosLykos commented on May 24, 2024

@MarvinJWendt, could you please share your thoughts on this?

from pterm.

MarvinJWendt avatar MarvinJWendt commented on May 24, 2024

What I could imagine is this:

  • New option in the InteractiveConfirmPrinter called InstantSelect
    • If InstantSelect is true: Pressing y or n will instantly confirm or abort the printer.
    • If QuickSelect is false: Return is needed after pressing y or n to select
      • While Return is not pressed, the user should be able to switch between y or n
  • InstantSelect should be true in DefaultInteractiveConfirm
    • That way, it can be disabled with .WithInstantSelect(false).

Any objections? :)

from pterm.

elfrucool avatar elfrucool commented on May 24, 2024

from pterm.

KarolosLykos avatar KarolosLykos commented on May 24, 2024

I had a similar idea, and I agree with @elfrucool. It seems more logical to have it disabled by default. In my PR, I added a new option WithConfirmation(true) to pterm.DefaultInteractiveConfirm to enable the behavior of waiting for the user to confirm their answer by pressing . Of course, naming is subject to change. 😄

from pterm.

jcohen98 avatar jcohen98 commented on May 24, 2024

Any updates on this? Waiting on this since its a great feature that helps prevent confusion on how the interactive confirm works in sequence with other inputs, such as the select or text input, which both require "Enter"

from pterm.

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.