GithubHelp home page GithubHelp logo

Set Tea program options about huh HOT 8 CLOSED

testinfected avatar testinfected commented on September 26, 2024
Set Tea program options

from huh.

Comments (8)

testinfected avatar testinfected commented on September 26, 2024 1

Ah makes sense, will try that

Thanks @caarlos0

from huh.

caarlos0 avatar caarlos0 commented on September 26, 2024

Maybe it's not needed: the form is a model, which you can then run as a regular bubbletea model, passing options as you need, e.g.: tea.Run(form, options...)

from huh.

testinfected avatar testinfected commented on September 26, 2024

I'm reopening since although I can workaround as @caarlos0 suggested, it forces to rewrite all the Run methods if I want to provide my own program with specific configuration options (e.g. without tty for CI runs).

from huh.

caarlos0 avatar caarlos0 commented on September 26, 2024

hey @testinfected, sorry, what do you mean by "rewriting all the Run methods"?

is your project OSS, or can you share an example of what you're doing?

from huh.

testinfected avatar testinfected commented on September 26, 2024

Unfortunately no the project is not open source, nevertheless I can share some details about what we're doing.

We have a CLI application for internal use. Some commands require interaction with the user (e.g. asking for confirmation, showing a spinner, showing interactive tables, and more).

We end-to-end test against the actual binary. In our CI those tests are run without a TTY and I want to setup the tea.Program with options WithInput(nil) and WithoutRenderer().

We also want to be able (with a command line flag), to switch off ANSI sequences for capturing and processing of ouput (using WithoutRenderer()).

Currently the Run() commands create the program so I don't see a way of configuring the program with options except from rewriting the Run() commands, which in turn might require to fork and modify the source code.

If we add a e.g. func (f *Form) RunWith/In(p *Program) error that would solve my issue. Same for spinner.

Hope that helps understanding our issues. If you have any more questions I can provide additional details.

Thanks

from huh.

caarlos0 avatar caarlos0 commented on September 26, 2024

see #109

from huh.

testinfected avatar testinfected commented on September 26, 2024

Great, many thanks

from huh.

testinfected avatar testinfected commented on September 26, 2024

Looks good to me

from huh.

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.