1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

Small adjustments + CHANGELOG for #865

This commit is contained in:
Andrey Nering
2022-10-14 16:45:04 -03:00
parent 403456d3dc
commit 99014ad38d
7 changed files with 18 additions and 12 deletions

View File

@@ -2,6 +2,9 @@
## Unreleased
- Added ability to set a different watch interval by setting
`interval: '500ms'` or using the `--interval=500ms` flag
([#813](https://github.com/go-task/task/issues/813), [#865](https://github.com/go-task/task/pull/865)).
- Add colored output to `--list`, `--list-all` and `--summary` flags ([#845](https://github.com/go-task/task/pull/845), [#874](https://github.com/go-task/task/pull/874)).
- Fix unexpected behavior where `label:` was being shown instead of the task
name on `--list`

View File

@@ -209,10 +209,6 @@ func main() {
e.InterceptInterruptSignals()
}
if e.Interval == "" {
e.Interval = strings.TrimSpace(interval)
}
ctx := context.Background()
if status {

View File

@@ -30,6 +30,7 @@ variable
| `-f` | `--force` | `bool` | `false` | Forces execution even when the task is up-to-date. |
| `-h` | `--help` | `bool` | `false` | Shows Task usage. |
| `-i` | `--init` | `bool` | `false` | Creates a new Taskfile.yaml in the current folder. |
| `-I` | `--interval` | `string` | `5s` | Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid [Go Duration](https://pkg.go.dev/time#ParseDuration). |
| `-l` | `--list` | `bool` | `false` | Lists tasks with description of current Taskfile. |
| `-a` | `--list-all` | `bool` | `false` | Lists tasks with or without a description. |
| `-o` | `--output` | `string` | Default set in the Taskfile or `intervealed` | Sets output style: [`interleaved`/`group`/`prefixed`]. |
@@ -84,6 +85,7 @@ Some environment variables can be overriden to adjust Task behavior.
| `method` | `string` | `checksum` | Default method in this Taskfile. Can be overriden in a task by task basis. Available options: `checksum`, `timestamp` and `none`. |
| `silent` | `bool` | `false` | Default "silent" options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis. |
| `run` | `string` | `always` | Default "run" option for this Taskfile. Available options: `always`, `once` and `when_changed`. |
| `interval` | `string` | `5s` | Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid [Go Duration](https://pkg.go.dev/time#ParseDuration). |
| `vars` | [`map[string]Variable`](#variable) | | Global variables. |
| `env` | [`map[string]Variable`](#variable) | | Global environment. |
| `dotenv` | `[]string` | | A list of `.env` file paths to be parsed. |

View File

@@ -1247,5 +1247,9 @@ With the flags `--watch` or `-w` task will watch for file changes
and run the task again. This requires the `sources` attribute to be given,
so task knows which files to watch.
The default watch interval is 5 seconds, but it's possible to change it by
either setting `interval: '500ms'` in the root of the Taskfile passing it
as an argument like `--interval=500ms`.
[gotemplate]: https://golang.org/pkg/text/template/
[minify]: https://github.com/tdewolff/minify/tree/master/cmd/minify

View File

@@ -1503,10 +1503,10 @@ Hello, World!
assert.NoError(t, e.Setup())
buff.Reset()
err := os.MkdirAll(dir+"/src", 0755)
err := os.MkdirAll(filepathext.SmartJoin(dir, "src"), 0755)
assert.NoError(t, err)
err = os.WriteFile(dir+"/src/a", []byte("test"), 0644)
err = os.WriteFile(filepathext.SmartJoin(dir, "src/a"), []byte("test"), 0644)
if err != nil {
t.Fatal(err)
}
@@ -1529,16 +1529,16 @@ Hello, World!
}(ctx)
time.Sleep(10 * time.Millisecond)
err = os.WriteFile(dir+"/src/a", []byte("test updated"), 0644)
err = os.WriteFile(filepathext.SmartJoin(dir, "src/a"), []byte("test updated"), 0644)
if err != nil {
t.Fatal(err)
}
time.Sleep(70 * time.Millisecond)
time.Sleep(700 * time.Millisecond)
cancel()
assert.Equal(t, expectedOutput, strings.TrimSpace(buff.String()))
buff.Reset()
err = os.RemoveAll(dir + "/.task")
err = os.RemoveAll(filepathext.SmartJoin(dir, ".task"))
assert.NoError(t, err)
err = os.RemoveAll(dir + "/src")
err = os.RemoveAll(filepathext.SmartJoin(dir, "src"))
assert.NoError(t, err)
}

View File

@@ -5,7 +5,7 @@ version: '3'
vars:
GREETING: Hello, World!
interval: "30ms"
interval: "500ms"
tasks:
default:

View File

@@ -51,7 +51,8 @@ func (e *Executor) watchTasks(calls ...taskfile.Call) error {
var err error
watchInterval, err = parseWatchInterval(watchIntervalString)
if err != nil {
e.Logger.Errf(logger.Red, "%v", err)
cancel()
return err
}
}