-
-
Notifications
You must be signed in to change notification settings - Fork 723
feat: added interactive vars using bubbletea #2379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
96c4b2c
to
b03bbb8
Compare
@sashokbg would it be more succinct to do something like:
Then you could:
|
Hello @trulede , thank you for your comment and suggestions. If I understand correctly there are two main things you want to discuss:
Isn't it simpler to just use newline separator ? About the "multi-select" I am not sure I will have the time to work on that now. Maybe first implement simple inputs / selects and see from there on ?
Regarding the --yes I think it will introduce ambiguity, since --yes is typically used for auto-confirmation and here we use it to kinda skip inputs.
In my opinion it would be best to first implement the --var parameter, to allow proper variable overriding and work from there on Thank you again for your comments |
My feedback was more along the lines of utilising/borrowing from the existing schema. For instance:
In this case, borrowing the I think there is a broader use case here, extending/intercepting the Task API. In your case, adapting a UI, in my case developing an audit-trail, printing debug info, or producing documentation. It would be easier to simply develop and publish an extension to Task ... but I'm not exactly sure how to do it. |
Hello, yes the idea of reusing "prompt" looks good. Actually I would be tempted to completely remove the defaults and use --var overrides. I opened another PR #2388 that adds this feature. So the way it would work is that whenever we run a taskfile that has interactive inputs in non-TTY, it would fail and ask you to run it with --var MYVAR=1 etc |
b03bbb8
to
da71de0
Compare
Hello @trulede I have made a modification by replacing the "interactive" key by "prompt". I also updated the PR description to illustrate it. Regarding the default values, I will try to use the defaults as described in the doc: https://taskfile.dev/docs/reference/templating#default-values-and-coalescing |
da71de0
to
dbcc5ce
Compare
This MR adds a new "interactive" option for the vars section. The var section can also be used together with the sh to pre-fill a drop-down list of choices for the user:
Examples:
Run:
go run ./cmd/task --dir ./testdata/vars/any interactive-simple
Shows:

Run
go run ./cmd/task --dir ./testdata/vars/any interactive-with-sh
Under the hood the second use case uses bubbletea
Any comments and suggestions are appreciated. Thank you !