Comments (8)
@elfrucool I've added a draft that includes this new functionality. Would you like to take a look and offer some feedback?
from pterm.
I'll take a look once I get a moment
from pterm.
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.
@MarvinJWendt, could you please share your thoughts on this?
from pterm.
What I could imagine is this:
- New option in the
InteractiveConfirmPrinter
calledInstantSelect
- If
InstantSelect
istrue
: Pressing y or n will instantly confirm or abort the printer. - If
QuickSelect
isfalse
: 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
- If
InstantSelect
should betrue
inDefaultInteractiveConfirm
- That way, it can be disabled with
.WithInstantSelect(false)
.
- That way, it can be disabled with
Any objections? :)
from pterm.
from pterm.
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.
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)
- Inject more `CallerOffset` in `pterm.NewSlogHandler` HOT 2
- Keep order of arguments in `SlogHandler` HOT 2
- PanelPrinter.Render always goes to stdout HOT 2
- AreaPrinter does not replace content in Git Bash HOT 1
- Update AreaPrinter.WithCenter() to allow individual centering of lines HOT 1
- Style.Sprintf and RGBStyle.Sprintf behave differently HOT 2
- Update `InteractiveMultiselectPrinter` to optionally show selected options HOT 4
- Progressbar and Logger do not work at the same time HOT 6
- Providing an odd number of arguments to a pterm Logger's Args method results in a panic
- Rewrite PR template
- Add `InteractiveNumberInput`
- pterm slog logger doesn't support anything lower than debug HOT 1
- Show `.DefaultValue` in `InteractiveTextPrinter`
- Update `Spinner` to support reseting timer HOT 4
- Use `strings.Builder` to save some memory
- bigtext example looks strange with powershell on windows 11 HOT 1
- Does pterm support serial port output?
- When using `UpdateText` with `Spinner`, the value of the old text is not cleared
- Allow customization of text "type to search"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pterm.