task
task copied to clipboard
Allow `status:` to run other tasks
When writing many commands we have a standard way of checking status for each. It would be nice to be able to write a task and use another task to check the status. For example:
tasks:
make:
status:
- task: check-file
vars: { FILE: path/to/file.exe }
cmds:
- do command
From what I can tell Status is just an []string rather than an []*Cmd. https://github.com/go-task/task/blob/master/taskfile/task.go#L16
Thoughts on updating it to work more like cmds? What potential pitfalls might occur?
Thanks!
Hi @dolfelt!
I think that this seems to make sense to have.
Changing Status from []string to []*Cmd is the initial step, but more changes will be needed to make it work.
+1 on this feature!
A possibly related question. Would having this feature result in being able to reference a variable in status: that is defined in the vars: of the same task?
...being able to reference a variable in
status:that is defined in thevars:of the same task?
err... please ignore the above comment, i just realized i was doing something wrong when testing this. it is possible to use a variable used in vars: in status:. sorry for the noise!
I think this is possibly similar to #178 basically, the ability to use tasks (or vars for that matter) kind of like functions. Thus supporting return values, and being to use tasks in other areas, like status. This is interesting, and I want to explore this type of functionality.