Coder Social home page Coder Social logo

Comments (7)

xavierog avatar xavierog commented on August 25, 2024 1

Btw, is there a keyboard shortcut to get my cursor inside the prompt's textbox?

Not in 1.14.0. But I have just pushed a commit (in the devel branch) that implements Ctrl+t and Ctrl+y, which jump to the previous/next unanswered question.

from moulti.

xavierog avatar xavierog commented on August 25, 2024

Technical notes: under the hood, supporting the pause module implies to support Display.prompt_until, a method that takes 5 arguments:

  • msg (str)
  • private (bool)
  • seconds: (int|None)
  • interrupt_input: (bytes|None)
  • complete_input: (bytes|None)

The first three arguments are already ok in my working directory.
interrupt_input and complete_input were designed with a tty in mind and translating them to a TUI requires some care:

  • interrupt_input could become an "Interrupt" push-button, a suitable replacement for ctrl+c, which is no longer available to Ansible;
  • each entry other than \r and \n in complete_input could become a new push-button.

Applied to the pause module, that would leave us with one input field and three buttons: "Interrupt", "A" and "C" (respectively "Abort" and "Continue").

These buttons should ideally appear right under the input field. The input field is not always necessary, but there is no proper way to tell. There are various approaches to that:

  • using an inputquestion widget and a buttonquestion widget:
    • pro: easy
    • con: clumsy-looking
    • con: we lack a straightforward way to obtain the first answer from two widgets
  • extending inputquestion so it offers optional push-buttons.
    • pro: useful
    • pro: better-looking
    • con: does that deserve a new widget? what should get-answer output?
    • con: more work

from moulti.

xavierog avatar xavierog commented on August 25, 2024

extending inputquestion so it offers optional push-buttons.

I chose this way. Specifically, I introduced a question widget that combines the abilities of inputquestion and buttonquestion:

questions-step05

widget \ feature input field buttons
inputquestion yes no
buttonquestion no at least 1
question Yes at least 1

That should help me implement this feature request.

from moulti.

xavierog avatar xavierog commented on August 25, 2024

I have implemented and pushed prompt_until():

Your example looks like this:
moulti-pause

This feature should land in the next release.

from moulti.

huyz avatar huyz commented on August 25, 2024

Wow, that's awesome! Bien joué!

from moulti.

xavierog avatar xavierog commented on August 25, 2024

This feature is now available as part of Moulti 1.14.0.

from moulti.

huyz avatar huyz commented on August 25, 2024

@xavierog Tested and it works great.

Btw, is there a keyboard shortcut to get my cursor inside the prompt's textbox?

from moulti.

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.