support interactive input to tasks
Check for existing issues
- [X] Completed
Describe the feature
i'd love to create a task like Pull package which allows me to write the name of a package so it can pull / build / some other things.
If applicable, add mockups / screenshots to help present your vision of the feature
No response
Can you explain your use case, language and environment better?
Generally, tasks already support interactive input, e.g.
{
"label": "test task with waiting",
"command": "sh -c",
"args": [
"'echo -n \"Create database? [y/N] \"; read -n 1 answer; echo; [ \"$answer\" = \"y\" ] || [ \"$answer\" = \"Y\" ] && echo \"Creating DB...\" || echo \"Aborted\"'"
]
},
on macOS will wait for Y or other input before continuing. Similarly, I can run some Python/Rust task that reads from stdin and it will work.
Similarly you could use the ZED_SELECTED_TEXT variable to make a task that does something based on a selection.
See: Tasks: Variables in the docs.
Using the selection doesn't work for my case since it's coming from my brain, not a text buffer.
The bash would work, but just would be nice to have a higher level API for this, like:
{
"label": "pull package",
"command": "sh -c",
"inputs": ["PACKAGE", "VERSION"],
"args": [
"pull-package $inputs.PACKAGE --version $inputs.VERSION"
]
},
A minimalist UI component like the one to select the task to spawn would be amazing.
We can ~~steal~~ borrow the implementation approach from VS Code https://code.visualstudio.com/docs/editor/variables-reference#_input-variables