Issue 813. Made watch interval configurable through global setting in Taskfile and through CLI arg.

Separated Taskfile param and Arg flag
This commit is contained in:
ilewin
2022-09-08 19:22:44 +02:00
parent 160b788198
commit 1c44d8049a
7 changed files with 122 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ func main() {
entrypoint string
output taskfile.Output
color bool
interval string
)
pflag.BoolVar(&versionFlag, "version", false, "show Task version")
@@ -96,6 +97,7 @@ func main() {
pflag.StringVar(&output.Group.End, "output-group-end", "", "message template to print after a task's grouped output")
pflag.BoolVarP(&color, "color", "c", true, "colored output. Enabled by default. Set flag to false or use NO_COLOR=1 to disable")
pflag.IntVarP(&concurrency, "concurrency", "C", 0, "limit number tasks to run concurrently")
pflag.StringVarP(&interval, "interval", "I", "5s", "interval to watch for changes")
pflag.Parse()
if versionFlag {
@@ -151,6 +153,7 @@ func main() {
Parallel: parallel,
Color: color,
Concurrency: concurrency,
Interval: interval,
Stdin: os.Stdin,
Stdout: os.Stdout,
@@ -206,6 +209,10 @@ func main() {
e.InterceptInterruptSignals()
}
if e.Interval == "" {
e.Interval = strings.TrimSpace(interval)
}
ctx := context.Background()
if status {