feat: added interactive vars using bubbletea#2379
feat: added interactive vars using bubbletea#2379sashokbg wants to merge 1 commit intogo-task:mainfrom
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
dbcc5ce to
e53565a
Compare
|
Hello, @andreynering @pd93 do you think this feature is mergeable as-is ? It is not breaking change and it already works with a simple taskfile like the one: |
e53565a to
de86773
Compare
|
Hello @vmaerten @andreynering could you kindly look at this small feature I have developed a while ago and tell me if it is ok to be merged in the project ? |
|
Hi @sashokbg. I'm sorry for the long wait. I know it is frustrating, but we just have a lot of work here and we work on Task on our free time. We now have a more complete implementation on the following PR, so I'm closing this as a duplicate. Thank you for your work anyway! Helping testing the other PR is also welcome. |
Hello @andreynering no problem, I understand completely. I will try to put some effort in the other PR ! |
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-simpleShows:

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