You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to pause and wait for user input, for subsequent use in the script:
test:
cmds:
- read name
- echo "hi ${name}"
$ task test
read name
task: Failed to run task "test": exit status 127
I also tried moving the read command to Taskvars, but still no luck. I suspect this is because execution of go-task does not allocate a TTY? Is there any way to do this currently?
read:
cmds:
- | echo "Type value of FOO:" read FOO; echo "You said: ${FOO}";silent: true
And for allowing read in variables, I don't know if that makes sense. One can pass parameters to tasks using environment variables or the special syntax:
Hi,
Stumbled upon this issue while trying to work out the exact same thing.
I want to ask the user for input for a few variables that are going to be used throughout the Taskfile.
Obviously, as you noted, something like this panics:
Well, as I've got quite a few variables to ask for, no (or only partially).
I wanna allow the user to supply some variables via CLI (if he wishes to automate the call), and ask for every variable that is missing.
Activity
andreynering commentedon Feb 17, 2018
I never thought about this possibility, and I don't know why it doesn't work. I'll think about it.
andreynering commentedon Mar 4, 2018
This currently possible as follows:
And for allowing
readin variables, I don't know if that makes sense. One can pass parameters to tasks using environment variables or the special syntax:tommyknows commentedon Feb 19, 2019
Hi,
Stumbled upon this issue while trying to work out the exact same thing.
I want to ask the user for input for a few variables that are going to be used throughout the Taskfile.
Obviously, as you noted, something like this panics:
At the same time, I can't use this:
Is there any way to export variables from the
cmdsto the taskfile?andreynering commentedon Feb 21, 2019
@tommyknows Isn't passing variables via CLI enough for you? (See my comment here)
tommyknows commentedon Feb 22, 2019
Well, as I've got quite a few variables to ask for, no (or only partially).
I wanna allow the user to supply some variables via CLI (if he wishes to automate the call), and ask for every variable that is missing.
andreynering commentedon Feb 24, 2019
I think doing that via
readresults in a bad UX experience, because the user won't know what variable they are typing.If we implement something to allow that, that should have be handled by Task, that would print something like this:
I still think using the CLI a better on most use cases, though.
andreynering commentedon Aug 18, 2019
Some discussion about adding this is happening at #236.