mirror of
https://github.com/go-task/task.git
synced 2026-06-23 12:45:52 +00:00
Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cded9af90f | ||
|
|
4e1f2ad017 | ||
|
|
7f92b7072d | ||
|
|
4a589ba6a4 | ||
|
|
7f16325fcc | ||
|
|
b62e5bf34c | ||
|
|
bd6b348cc7 | ||
|
|
62f35fe8c8 | ||
|
|
cb2cb4659c | ||
|
|
a2c58415cf | ||
|
|
2cb9987c99 | ||
|
|
36584cfb7c | ||
|
|
b825ad6a12 | ||
|
|
f8545d4c61 | ||
|
|
9b42ef5d46 | ||
|
|
05ddfc0495 | ||
|
|
53b2cebb66 | ||
|
|
837fb71a24 | ||
|
|
2e13cf5f74 | ||
|
|
0ae1681d9c | ||
|
|
ebb66ba8fb | ||
|
|
e79354a039 | ||
|
|
a57beb1de4 | ||
|
|
1648c44ee2 | ||
|
|
efe47a149e | ||
|
|
2d66a2f0f3 | ||
|
|
43a1f1314e | ||
|
|
4f4b282d7c | ||
|
|
d3d4da18e5 | ||
|
|
b8da583986 | ||
|
|
73f6b42715 | ||
|
|
0e2a4efdaa | ||
|
|
6798e16aaf | ||
|
|
c9cc64ecfc | ||
|
|
761f9045ac | ||
|
|
dfae979287 | ||
|
|
fe917affd2 | ||
|
|
d44207dd7f | ||
|
|
ec8b1403bd | ||
|
|
6f3d108c1e | ||
|
|
c34ee9c1f9 | ||
|
|
2a3f049336 | ||
|
|
0c91011e88 | ||
|
|
8bcd8719aa | ||
|
|
29a8af509b | ||
|
|
d3cd9f17f9 |
10
.github/dependabot.yml
vendored
Normal file
10
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: gomod
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: saturday
|
||||||
|
time: '08:00'
|
||||||
|
timezone: America/Sao_Paulo
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -19,8 +19,9 @@ dist/
|
|||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# intellij idea/goland
|
# editors
|
||||||
.idea/
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
# exuberant ctags
|
# exuberant ctags
|
||||||
tags
|
tags
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
build:
|
build:
|
||||||
binary: task
|
binary: task
|
||||||
main: cmd/task/task.go
|
main: cmd/task
|
||||||
goos:
|
goos:
|
||||||
- windows
|
- windows
|
||||||
- darwin
|
- darwin
|
||||||
@@ -17,6 +17,11 @@ build:
|
|||||||
goarch: 386
|
goarch: 386
|
||||||
env:
|
env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
|
ldflags:
|
||||||
|
- -s -w # Don't set main.version.
|
||||||
|
|
||||||
|
gomod:
|
||||||
|
proxy: true
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
|
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
|
||||||
|
|||||||
29
CHANGELOG.md
29
CHANGELOG.md
@@ -1,5 +1,34 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v3.4.3 - 2021-05-30
|
||||||
|
|
||||||
|
- Add support for the `NO_COLOR` environment variable.
|
||||||
|
([#459](https://github.com/go-task/task/issues/459), [fatih/color#137](https://github.com/fatih/color/pull/137)).
|
||||||
|
- Fix bug where sources were not considering the right directory
|
||||||
|
in `--watch` mode
|
||||||
|
([#484](https://github.com/go-task/task/issues/484), [#485](https://github.com/go-task/task/pull/485)).
|
||||||
|
|
||||||
|
## v3.4.2 - 2021-04-23
|
||||||
|
|
||||||
|
- On watch, report which file failed to read
|
||||||
|
([#472](https://github.com/go-task/task/pull/472)).
|
||||||
|
- Do not try to catch SIGKILL signal, which are not actually possible
|
||||||
|
([#476](https://github.com/go-task/task/pull/476)).
|
||||||
|
- Improve version reporting when building Task from source using Go Modules
|
||||||
|
([#462](https://github.com/go-task/task/pull/462), [#473](https://github.com/go-task/task/pull/473)).
|
||||||
|
|
||||||
|
## v3.4.1 - 2021-04-17
|
||||||
|
|
||||||
|
- Improve error reporting when parsing YAML: in some situations where you
|
||||||
|
would just see an generic error, you'll now see the actual error with
|
||||||
|
more detail: the YAML line the failed to parse, for example
|
||||||
|
([#467](https://github.com/go-task/task/issues/467)).
|
||||||
|
- A JSON Schema was published [here](https://json.schemastore.org/taskfile.json)
|
||||||
|
and is automatically being used by some editors like Visual Studio Code
|
||||||
|
([#135](https://github.com/go-task/task/issues/135)).
|
||||||
|
- Print task name before the command in the log output
|
||||||
|
([#398](https://github.com/go-task/task/pull/398)).
|
||||||
|
|
||||||
## v3.3.0 - 2021-03-20
|
## v3.3.0 - 2021-03-20
|
||||||
|
|
||||||
- Add support for delegating CLI arguments to commands with `--` and a
|
- Add support for delegating CLI arguments to commands with `--` and a
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
version = "master"
|
version = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [--taskfile] [--dry] [--summary] [task...]
|
const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [--taskfile] [--dry] [--summary] [task...]
|
||||||
@@ -88,12 +89,12 @@ func main() {
|
|||||||
pflag.StringVarP(&dir, "dir", "d", "", "sets directory of execution")
|
pflag.StringVarP(&dir, "dir", "d", "", "sets directory of execution")
|
||||||
pflag.StringVarP(&entrypoint, "taskfile", "t", "", `choose which Taskfile to run. Defaults to "Taskfile.yml"`)
|
pflag.StringVarP(&entrypoint, "taskfile", "t", "", `choose which Taskfile to run. Defaults to "Taskfile.yml"`)
|
||||||
pflag.StringVarP(&output, "output", "o", "", "sets output style: [interleaved|group|prefixed]")
|
pflag.StringVarP(&output, "output", "o", "", "sets output style: [interleaved|group|prefixed]")
|
||||||
pflag.BoolVarP(&color, "color", "c", true, "colored 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.IntVarP(&concurrency, "concurrency", "C", 0, "limit number tasks to run concurrently")
|
||||||
pflag.Parse()
|
pflag.Parse()
|
||||||
|
|
||||||
if versionFlag {
|
if versionFlag {
|
||||||
fmt.Printf("Task version: %s\n", version)
|
fmt.Printf("Task version: %s\n", getVersion())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +209,7 @@ func getArgs() (tasksAndVars, cliArgs []string) {
|
|||||||
|
|
||||||
func getSignalContext() context.Context {
|
func getSignalContext() context.Context {
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
signal.Notify(ch, os.Interrupt, os.Kill, syscall.SIGTERM)
|
signal.Notify(ch, os.Interrupt, syscall.SIGTERM)
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
go func() {
|
go func() {
|
||||||
sig := <-ch
|
sig := <-ch
|
||||||
@@ -217,3 +218,21 @@ func getSignalContext() context.Context {
|
|||||||
}()
|
}()
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getVersion() string {
|
||||||
|
if version != "" {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok || info.Main.Version == "" {
|
||||||
|
return "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
version = info.Main.Version
|
||||||
|
if info.Main.Sum != "" {
|
||||||
|
version += fmt.Sprintf(" (%s)", info.Main.Sum)
|
||||||
|
}
|
||||||
|
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
- [Usage](usage.md)
|
- [Usage](usage.md)
|
||||||
- [Styleguide](styleguide.md)
|
- [Styleguide](styleguide.md)
|
||||||
- [Taskfile Versions](taskfile_versions.md)
|
- [Taskfile Versions](taskfile_versions.md)
|
||||||
- [Examples](examples.md)
|
- [Community](community.md)
|
||||||
- [Releasing Task](releasing_task.md)
|
- [Releasing Task](releasing_task.md)
|
||||||
- [Donate](donate.md)
|
- [Donate](donate.md)
|
||||||
- [GitHub](https://github.com/go-task/task)
|
- [GitHub](https://github.com/go-task/task)
|
||||||
|
|||||||
44
docs/community.md
Normal file
44
docs/community.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# Community
|
||||||
|
|
||||||
|
Some of the work to improve the Task ecosystem is done by the community, be
|
||||||
|
it installation methods or integrations with code editor. I (the author) am
|
||||||
|
thankful for everyone that helps me to improve the overall experience.
|
||||||
|
|
||||||
|
## Editor Integrations
|
||||||
|
|
||||||
|
### JSON Schema
|
||||||
|
|
||||||
|
[@KROSF](https://github.com/KROSF) worked on a JSON Schema [into this Gist](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895),
|
||||||
|
which later was made officially available by [@Crandel](https://github.com/Crandel)
|
||||||
|
at [https://json.schemastore.org/taskfile.json](https://json.schemastore.org/taskfile.json).
|
||||||
|
Further improvements are possible by opening pull requests changing
|
||||||
|
[this file](https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/taskfile.json).
|
||||||
|
Some code editors, like Visual Studio Code, make use of Schema Store
|
||||||
|
automatically.
|
||||||
|
|
||||||
|
### Visual Studio Code extension
|
||||||
|
|
||||||
|
Additionally, there's also some work done by
|
||||||
|
[@paulvarache](https://github.com/paulvarache) in making an Visual Studio Code
|
||||||
|
extension, which has its code [here](https://github.com/paulvarache/vscode-taskfile)
|
||||||
|
and is published [here](https://marketplace.visualstudio.com/items?itemName=paulvarache.vscode-taskfile).
|
||||||
|
|
||||||
|
## Installation methods
|
||||||
|
|
||||||
|
Some installation methods are maintained by third party:
|
||||||
|
|
||||||
|
- [GitHub Actions](https://github.com/arduino/setup-task)
|
||||||
|
by [@arduino](https://github.com/arduino)
|
||||||
|
- [AUR](https://aur.archlinux.org/packages/taskfile-git)
|
||||||
|
by [@kovetskiy](https://github.com/kovetskiy)
|
||||||
|
- [Scoop](https://github.com/lukesampson/scoop-extras/blob/master/bucket/task.json)
|
||||||
|
|
||||||
|
## More
|
||||||
|
|
||||||
|
Also, thanks for all the [code contributors](https://github.com/go-task/task/graphs/contributors),
|
||||||
|
[financial contributors](https://opencollective.com/task), all those who
|
||||||
|
[reported bugs](https://github.com/go-task/task/issues?q=is%3Aissue) and
|
||||||
|
[answered questions](https://github.com/go-task/task/discussions).
|
||||||
|
|
||||||
|
If you know something that is missing in this document, please submit a
|
||||||
|
pull request.
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# Examples
|
|
||||||
|
|
||||||
The [go-task/examples][examples] intends to be a collection of Taskfiles for
|
|
||||||
various use cases.
|
|
||||||
(It still lacks many examples, though. Contributions are welcome).
|
|
||||||
|
|
||||||
[examples]: https://github.com/go-task/examples
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
<meta name="description" content="A task runner / simpler Make alternative written in Go">
|
<meta name="description" content="A task runner / simpler Make alternative written in Go">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify-themeable/dist/css/theme-simple.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css">
|
||||||
<meta name="google-site-verification" content="VGAYkbdmuaciIDGkBe-eAg9yfZg0C6ostgonbGxxOa0" />
|
<meta name="google-site-verification" content="VGAYkbdmuaciIDGkBe-eAg9yfZg0C6ostgonbGxxOa0" />
|
||||||
<style>
|
<style>
|
||||||
#logo {
|
#logo {
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
.app-name-link img {
|
.app-name-link img {
|
||||||
width: 125px;
|
width: 125px;
|
||||||
}
|
}
|
||||||
|
:root {
|
||||||
|
--base-font-size: 14px;
|
||||||
|
--theme-color: #29beb0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ The `task_checksums.txt` file contains the SHA-256 checksum for each file.
|
|||||||
|
|
||||||
#### **Install Script**
|
#### **Install Script**
|
||||||
|
|
||||||
We also have a [install script][installscript], which is very useful on
|
We also have an [install script][installscript] which is very useful in
|
||||||
scenarios like CIs. Many thanks to [GoDownloader][godownloader] for allowing
|
scenarios like CI. Many thanks to [GoDownloader][godownloader] for enabling the
|
||||||
easily generating this script.
|
easy generation of this script.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# For Default Installion to ./bin with debug logging
|
# For Default Installation to ./bin with debug logging
|
||||||
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
|
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
|
||||||
|
|
||||||
# For Installation To /usr/local/bin for userwide access with debug logging
|
# For Installation To /usr/local/bin for userwide access with debug logging
|
||||||
@@ -87,12 +87,12 @@ sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/b
|
|||||||
#### **GitHub Actions**
|
#### **GitHub Actions**
|
||||||
|
|
||||||
If you want to install Task in GitHub Actions you can try using
|
If you want to install Task in GitHub Actions you can try using
|
||||||
[this action](https://github.com/arduino/actions/tree/master/setup-taskfile)
|
[this action](https://github.com/arduino/setup-task)
|
||||||
by the Arduino team:
|
by the Arduino team:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install Task
|
- name: Install Task
|
||||||
uses: Arduino/actions/setup-taskfile@master
|
uses: arduino/setup-task@v1
|
||||||
```
|
```
|
||||||
|
|
||||||
This installation method is community owned.
|
This installation method is community owned.
|
||||||
@@ -107,29 +107,27 @@ This installation method is community owned.
|
|||||||
|
|
||||||
First, make sure you have [Go][go] properly installed and setup.
|
First, make sure you have [Go][go] properly installed and setup.
|
||||||
|
|
||||||
You can easily install it globally by running:
|
You can easily install the latest release globally by running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go get -u github.com/go-task/task/v3/cmd/task
|
go install github.com/go-task/task/v3/cmd/task@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Or you can install into another directory:
|
Or you can install into another directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/go-task/task
|
env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
|
||||||
cd task
|
```
|
||||||
|
|
||||||
# Compiling binary to $GOPATH/bin
|
If using Go 1.15 or earlier, instead use:
|
||||||
go install -v ./cmd/task
|
|
||||||
|
|
||||||
# Compiling it to another location.
|
```bash
|
||||||
# Use -o ./task.exe on Windows.
|
env GO111MODULE=on go get -u github.com/go-task/task/v3/cmd/task@latest
|
||||||
go build -v -o ./task ./cmd/task
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> For CI environments we recommend using the [Install Script](#get-the-binary)
|
> For CI environments we recommend using the [Install Script](#get-the-binary)
|
||||||
> instead, which is faster and more stable, since it'll just download the latest
|
> instead, which is faster and more stable, since it'll just download the latest
|
||||||
> released binary, instead of compiling the edge (master branch) version.
|
> released binary.
|
||||||
|
|
||||||
<!-- tabs:end -->
|
<!-- tabs:end -->
|
||||||
|
|
||||||
|
|||||||
@@ -36,4 +36,4 @@ If you think its Task version is outdated, open an issue to let us know.
|
|||||||
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb
|
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb
|
||||||
[snappackage]: https://github.com/go-task/snap
|
[snappackage]: https://github.com/go-task/snap
|
||||||
[snapcraftyaml]: https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2
|
[snapcraftyaml]: https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2
|
||||||
[snapcraftdashboard]: https://dashboard.snapcraft.io/
|
[snapcraftdashboard]: https://snapcraft.io/task/releases
|
||||||
|
|||||||
13
go.mod
13
go.mod
@@ -1,17 +1,16 @@
|
|||||||
module github.com/go-task/task/v3
|
module github.com/go-task/task/v3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fatih/color v1.7.0
|
github.com/fatih/color v1.12.0
|
||||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
|
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
|
||||||
github.com/joho/godotenv v1.3.0
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/mattn/go-colorable v0.1.2 // indirect
|
github.com/mattn/go-zglob v0.0.3
|
||||||
github.com/mattn/go-zglob v0.0.1
|
github.com/radovskyb/watcher v1.0.7
|
||||||
github.com/radovskyb/watcher v1.0.5
|
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/stretchr/testify v1.5.1
|
github.com/stretchr/testify v1.7.0
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
|
||||||
mvdan.cc/sh/v3 v3.2.4
|
mvdan.cc/sh/v3 v3.3.0
|
||||||
)
|
)
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|||||||
59
go.sum
59
go.sum
@@ -1,3 +1,4 @@
|
|||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
|
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
|
||||||
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -6,54 +7,54 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
|||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
|
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
|
||||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
github.com/google/renameio v1.0.1-0.20210406141108-81588dbe0453/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWUAweKUpk=
|
||||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||||
github.com/mattn/go-zglob v0.0.1 h1:xsEx/XUoVlI6yXjqBK062zYhRTZltCNmYPx6v+8DNaY=
|
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||||
github.com/mattn/go-zglob v0.0.1/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/pkg/diff v0.0.0-20200914180035-5b29258ca4f7/go.mod h1:zO8QMzTeZd5cpnIkz/Gn6iK0jDfGicM1nynOkkPIl28=
|
github.com/mattn/go-zglob v0.0.3 h1:6Ry4EYsScDyt5di4OI6xw1bYhOqfE5S33Z1OPy+d+To=
|
||||||
|
github.com/mattn/go-zglob v0.0.3/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
|
||||||
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/radovskyb/watcher v1.0.5 h1:wqt7gb+HjGacvFoLTKeT44C+XVPxu7bvHvKT1IvZ7rw=
|
github.com/radovskyb/watcher v1.0.7 h1:AYePLih6dpmS32vlHfhCeli8127LzkIgwJGcwwe8tUE=
|
||||||
github.com/radovskyb/watcher v1.0.5/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
|
github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
|
||||||
github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
github.com/rogpeppe/go-internal v1.7.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
||||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20201029080932-201ba4db2418 h1:HlFl4V6pEMziuLXyRkm5BIYq1y1GAbb02pRlWvI54OM=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201029080932-201ba4db2418/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/term v0.0.0-20191110171634-ad39bd3f0407 h1:5zh5atpUEdIc478E/ebrIaHLKcfVvG6dL/fGv7BcMoM=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/term v0.0.0-20191110171634-ad39bd3f0407/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324 h1:pAwJxDByZctfPwzlNGrDN2BQLsdPb9NkhoTJtUkAO28=
|
||||||
|
golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
|
||||||
|
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
mvdan.cc/editorconfig v0.1.1-0.20200121172147-e40951bde157/go.mod h1:Ge4atmRUYqueGppvJ7JNrtqpqokoJEFxYbP0Z+WeKS8=
|
mvdan.cc/editorconfig v0.2.0/go.mod h1:lvnnD3BNdBYkhq+B4uBuFFKatfp02eB6HixDvEz91C0=
|
||||||
mvdan.cc/sh/v3 v3.2.4 h1:+fZaWcXWRjYAvqzEKoDhDM3DkxdDUykU2iw0VMKFe9s=
|
mvdan.cc/sh/v3 v3.3.0 h1:ujzElMnry63f4I5sjPFxzo6xia+gwsHZM0yyauuyZ6k=
|
||||||
mvdan.cc/sh/v3 v3.2.4/go.mod h1:fPQmabBpREM/XQ9YXSU5ZFZ/Sm+PmKP9/vkFHgYKJEI=
|
mvdan.cc/sh/v3 v3.3.0/go.mod h1:dh3avhLDhJJ/MJKzbak6FYn+DJKUWk7Fb6Dh5mGdv6Y=
|
||||||
|
|||||||
@@ -6,17 +6,16 @@ import (
|
|||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Color func() PrintFunc
|
||||||
type PrintFunc func(io.Writer, string, ...interface{})
|
type PrintFunc func(io.Writer, string, ...interface{})
|
||||||
|
|
||||||
var (
|
func Default() PrintFunc { return color.New(color.Reset).FprintfFunc() }
|
||||||
Default PrintFunc = color.New(color.Reset).FprintfFunc()
|
func Blue() PrintFunc { return color.New(color.FgBlue).FprintfFunc() }
|
||||||
Blue PrintFunc = color.New(color.FgBlue).FprintfFunc()
|
func Green() PrintFunc { return color.New(color.FgGreen).FprintfFunc() }
|
||||||
Green PrintFunc = color.New(color.FgGreen).FprintfFunc()
|
func Cyan() PrintFunc { return color.New(color.FgCyan).FprintfFunc() }
|
||||||
Cyan PrintFunc = color.New(color.FgCyan).FprintfFunc()
|
func Yellow() PrintFunc { return color.New(color.FgYellow).FprintfFunc() }
|
||||||
Yellow PrintFunc = color.New(color.FgYellow).FprintfFunc()
|
func Magenta() PrintFunc { return color.New(color.FgMagenta).FprintfFunc() }
|
||||||
Magenta PrintFunc = color.New(color.FgMagenta).FprintfFunc()
|
func Red() PrintFunc { return color.New(color.FgRed).FprintfFunc() }
|
||||||
Red PrintFunc = color.New(color.FgRed).FprintfFunc()
|
|
||||||
)
|
|
||||||
|
|
||||||
// Logger is just a wrapper that prints stuff to STDOUT or STDERR,
|
// Logger is just a wrapper that prints stuff to STDOUT or STDERR,
|
||||||
// with optional color.
|
// with optional color.
|
||||||
@@ -28,37 +27,39 @@ type Logger struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Outf prints stuff to STDOUT.
|
// Outf prints stuff to STDOUT.
|
||||||
func (l *Logger) Outf(print PrintFunc, s string, args ...interface{}) {
|
func (l *Logger) Outf(color Color, s string, args ...interface{}) {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
s, args = "%s", []interface{}{s}
|
s, args = "%s", []interface{}{s}
|
||||||
}
|
}
|
||||||
if !l.Color {
|
if !l.Color {
|
||||||
print = Default
|
color = Default
|
||||||
}
|
}
|
||||||
|
print := color()
|
||||||
print(l.Stdout, s+"\n", args...)
|
print(l.Stdout, s+"\n", args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerboseOutf prints stuff to STDOUT if verbose mode is enabled.
|
// VerboseOutf prints stuff to STDOUT if verbose mode is enabled.
|
||||||
func (l *Logger) VerboseOutf(print PrintFunc, s string, args ...interface{}) {
|
func (l *Logger) VerboseOutf(color Color, s string, args ...interface{}) {
|
||||||
if l.Verbose {
|
if l.Verbose {
|
||||||
l.Outf(print, s, args...)
|
l.Outf(color, s, args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Errf prints stuff to STDERR.
|
// Errf prints stuff to STDERR.
|
||||||
func (l *Logger) Errf(print PrintFunc, s string, args ...interface{}) {
|
func (l *Logger) Errf(color Color, s string, args ...interface{}) {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
s, args = "%s", []interface{}{s}
|
s, args = "%s", []interface{}{s}
|
||||||
}
|
}
|
||||||
if !l.Color {
|
if !l.Color {
|
||||||
print = Default
|
color = Default
|
||||||
}
|
}
|
||||||
|
print := color()
|
||||||
print(l.Stderr, s+"\n", args...)
|
print(l.Stderr, s+"\n", args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerboseErrf prints stuff to STDERR if verbose mode is enabled.
|
// VerboseErrf prints stuff to STDERR if verbose mode is enabled.
|
||||||
func (l *Logger) VerboseErrf(print PrintFunc, s string, args ...interface{}) {
|
func (l *Logger) VerboseErrf(color Color, s string, args ...interface{}) {
|
||||||
if l.Verbose {
|
if l.Verbose {
|
||||||
l.Errf(print, s, args...)
|
l.Errf(color, s, args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ func (c *Checksum) IsUpToDate() (bool, error) {
|
|||||||
if len(c.Generates) > 0 {
|
if len(c.Generates) > 0 {
|
||||||
// For each specified 'generates' field, check whether the files actually exist
|
// For each specified 'generates' field, check whether the files actually exist
|
||||||
for _, g := range c.Generates {
|
for _, g := range c.Generates {
|
||||||
generates, err := glob(c.TaskDir, g)
|
generates, err := Glob(c.TaskDir, g)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
func globs(dir string, globs []string) ([]string, error) {
|
func globs(dir string, globs []string) ([]string, error) {
|
||||||
files := make([]string, 0)
|
files := make([]string, 0)
|
||||||
for _, g := range globs {
|
for _, g := range globs {
|
||||||
f, err := glob(dir, g)
|
f, err := Glob(dir, g)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ func globs(dir string, globs []string) ([]string, error) {
|
|||||||
return files, nil
|
return files, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func glob(dir string, g string) ([]string, error) {
|
func Glob(dir string, g string) ([]string, error) {
|
||||||
files := make([]string, 0)
|
files := make([]string, 0)
|
||||||
if !filepath.IsAbs(g) {
|
if !filepath.IsAbs(g) {
|
||||||
g = filepath.Join(dir, g)
|
g = filepath.Join(dir, g)
|
||||||
|
|||||||
4
task.go
4
task.go
@@ -366,7 +366,7 @@ func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfi
|
|||||||
return nil
|
return nil
|
||||||
case cmd.Cmd != "":
|
case cmd.Cmd != "":
|
||||||
if e.Verbose || (!cmd.Silent && !t.Silent && !e.Taskfile.Silent && !e.Silent) {
|
if e.Verbose || (!cmd.Silent && !t.Silent && !e.Taskfile.Silent && !e.Silent) {
|
||||||
e.Logger.Errf(logger.Green, "task: %s", cmd.Cmd)
|
e.Logger.Errf(logger.Green, "task: [%s] %s", t.Name(), cmd.Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.Dry {
|
if e.Dry {
|
||||||
@@ -397,7 +397,7 @@ func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfi
|
|||||||
Stderr: stdErr,
|
Stderr: stdErr,
|
||||||
})
|
})
|
||||||
if execext.IsExitError(err) && cmd.IgnoreError {
|
if execext.IsExitError(err) && cmd.IgnoreError {
|
||||||
e.Logger.VerboseErrf(logger.Yellow, "task: command error ignored: %v", err)
|
e.Logger.VerboseErrf(logger.Yellow, "task: [%s] command error ignored: %v", t.Name(), err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ import (
|
|||||||
"github.com/go-task/task/v3/taskfile"
|
"github.com/go-task/task/v3/taskfile"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
_ = os.Setenv("NO_COLOR", "1")
|
||||||
|
}
|
||||||
|
|
||||||
// fileContentTest provides a basic reusable test-case for running a Taskfile
|
// fileContentTest provides a basic reusable test-case for running a Taskfile
|
||||||
// and inspect generated files.
|
// and inspect generated files.
|
||||||
type fileContentTest struct {
|
type fileContentTest struct {
|
||||||
@@ -626,7 +630,7 @@ func TestDry(t *testing.T) {
|
|||||||
assert.NoError(t, e.Setup())
|
assert.NoError(t, e.Setup())
|
||||||
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "build"}))
|
assert.NoError(t, e.Run(context.Background(), taskfile.Call{Task: "build"}))
|
||||||
|
|
||||||
assert.Equal(t, "task: touch file.txt", strings.TrimSpace(buff.String()))
|
assert.Equal(t, "task: [build] touch file.txt", strings.TrimSpace(buff.String()))
|
||||||
if _, err := os.Stat(file); err == nil {
|
if _, err := os.Stat(file); err == nil {
|
||||||
t.Errorf("File should not exist %s", file)
|
t.Errorf("File should not exist %s", file)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package taskfile
|
package taskfile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,13 +19,6 @@ type Dep struct {
|
|||||||
Vars *Vars
|
Vars *Vars
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
// ErrCantUnmarshalCmd is returned for invalid command YAML
|
|
||||||
ErrCantUnmarshalCmd = errors.New("task: can't unmarshal cmd value")
|
|
||||||
// ErrCantUnmarshalDep is returned for invalid dependency YAML
|
|
||||||
ErrCantUnmarshalDep = errors.New("task: can't unmarshal dep value")
|
|
||||||
)
|
|
||||||
|
|
||||||
// UnmarshalYAML implements yaml.Unmarshaler interface
|
// UnmarshalYAML implements yaml.Unmarshaler interface
|
||||||
func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||||
var cmd string
|
var cmd string
|
||||||
@@ -53,12 +45,12 @@ func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
Task string
|
Task string
|
||||||
Vars *Vars
|
Vars *Vars
|
||||||
}
|
}
|
||||||
if err := unmarshal(&taskCall); err == nil {
|
if err := unmarshal(&taskCall); err != nil {
|
||||||
c.Task = taskCall.Task
|
return err
|
||||||
c.Vars = taskCall.Vars
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return ErrCantUnmarshalCmd
|
c.Task = taskCall.Task
|
||||||
|
c.Vars = taskCall.Vars
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalYAML implements yaml.Unmarshaler interface
|
// UnmarshalYAML implements yaml.Unmarshaler interface
|
||||||
@@ -72,10 +64,10 @@ func (d *Dep) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
Task string
|
Task string
|
||||||
Vars *Vars
|
Vars *Vars
|
||||||
}
|
}
|
||||||
if err := unmarshal(&taskCall); err == nil {
|
if err := unmarshal(&taskCall); err != nil {
|
||||||
d.Task = taskCall.Task
|
return err
|
||||||
d.Vars = taskCall.Vars
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
return ErrCantUnmarshalDep
|
d.Task = taskCall.Task
|
||||||
|
d.Vars = taskCall.Vars
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
// ErrCantUnmarshalIncludedTaskfile is returned for invalid var YAML.
|
|
||||||
ErrCantUnmarshalIncludedTaskfile = errors.New("task: can't unmarshal included value")
|
|
||||||
)
|
|
||||||
|
|
||||||
// IncludedTaskfile represents information about included tasksfile
|
// IncludedTaskfile represents information about included tasksfile
|
||||||
type IncludedTaskfile struct {
|
type IncludedTaskfile struct {
|
||||||
Taskfile string
|
Taskfile string
|
||||||
@@ -98,12 +93,11 @@ func (it *IncludedTaskfile) UnmarshalYAML(unmarshal func(interface{}) error) err
|
|||||||
Taskfile string
|
Taskfile string
|
||||||
Dir string
|
Dir string
|
||||||
}
|
}
|
||||||
if err := unmarshal(&includedTaskfile); err == nil {
|
if err := unmarshal(&includedTaskfile); err != nil {
|
||||||
it.Dir = includedTaskfile.Dir
|
return err
|
||||||
it.Taskfile = includedTaskfile.Taskfile
|
|
||||||
it.AdvancedImport = true
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
it.Dir = includedTaskfile.Dir
|
||||||
return ErrCantUnmarshalIncludedTaskfile
|
it.Taskfile = includedTaskfile.Taskfile
|
||||||
|
it.AdvancedImport = true
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package taskfile
|
package taskfile
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Tasks represents a group of tasks
|
// Tasks represents a group of tasks
|
||||||
type Tasks map[string]*Task
|
type Tasks map[string]*Task
|
||||||
|
|
||||||
@@ -28,11 +24,6 @@ type Task struct {
|
|||||||
IgnoreError bool
|
IgnoreError bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
// ErrCantUnmarshalTask is returned for invalid task YAML
|
|
||||||
ErrCantUnmarshalTask = errors.New("task: can't unmarshal task value")
|
|
||||||
)
|
|
||||||
|
|
||||||
func (t *Task) Name() string {
|
func (t *Task) Name() string {
|
||||||
if t.Label != "" {
|
if t.Label != "" {
|
||||||
return t.Label
|
return t.Label
|
||||||
@@ -71,26 +62,24 @@ func (t *Task) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
Prefix string
|
Prefix string
|
||||||
IgnoreError bool `yaml:"ignore_error"`
|
IgnoreError bool `yaml:"ignore_error"`
|
||||||
}
|
}
|
||||||
if err := unmarshal(&task); err == nil {
|
if err := unmarshal(&task); err != nil {
|
||||||
t.Cmds = task.Cmds
|
return err
|
||||||
t.Deps = task.Deps
|
|
||||||
t.Label = task.Label
|
|
||||||
t.Desc = task.Desc
|
|
||||||
t.Summary = task.Summary
|
|
||||||
t.Sources = task.Sources
|
|
||||||
t.Generates = task.Generates
|
|
||||||
t.Status = task.Status
|
|
||||||
t.Preconditions = task.Preconditions
|
|
||||||
t.Dir = task.Dir
|
|
||||||
t.Vars = task.Vars
|
|
||||||
t.Env = task.Env
|
|
||||||
t.Silent = task.Silent
|
|
||||||
t.Method = task.Method
|
|
||||||
t.Prefix = task.Prefix
|
|
||||||
t.IgnoreError = task.IgnoreError
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
t.Cmds = task.Cmds
|
||||||
return ErrCantUnmarshalTask
|
t.Deps = task.Deps
|
||||||
|
t.Label = task.Label
|
||||||
|
t.Desc = task.Desc
|
||||||
|
t.Summary = task.Summary
|
||||||
|
t.Sources = task.Sources
|
||||||
|
t.Generates = task.Generates
|
||||||
|
t.Status = task.Status
|
||||||
|
t.Preconditions = task.Preconditions
|
||||||
|
t.Dir = task.Dir
|
||||||
|
t.Vars = task.Vars
|
||||||
|
t.Env = task.Env
|
||||||
|
t.Silent = task.Silent
|
||||||
|
t.Method = task.Method
|
||||||
|
t.Prefix = task.Prefix
|
||||||
|
t.IgnoreError = task.IgnoreError
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,6 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
// ErrCantUnmarshalVar is returned for invalid var YAML.
|
|
||||||
ErrCantUnmarshalVar = errors.New("task: can't unmarshal var value")
|
|
||||||
)
|
|
||||||
|
|
||||||
// Vars is a string[string] variables map.
|
// Vars is a string[string] variables map.
|
||||||
type Vars struct {
|
type Vars struct {
|
||||||
Keys []string
|
Keys []string
|
||||||
@@ -124,10 +119,9 @@ func (v *Var) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|||||||
var sh struct {
|
var sh struct {
|
||||||
Sh string
|
Sh string
|
||||||
}
|
}
|
||||||
if err := unmarshal(&sh); err == nil {
|
if err := unmarshal(&sh); err != nil {
|
||||||
v.Sh = sh.Sh
|
return err
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
v.Sh = sh.Sh
|
||||||
return ErrCantUnmarshalVar
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
7
watch.go
7
watch.go
@@ -2,6 +2,7 @@ package task
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -10,8 +11,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-task/task/v3/internal/logger"
|
"github.com/go-task/task/v3/internal/logger"
|
||||||
|
"github.com/go-task/task/v3/internal/status"
|
||||||
"github.com/go-task/task/v3/taskfile"
|
"github.com/go-task/task/v3/taskfile"
|
||||||
"github.com/mattn/go-zglob"
|
|
||||||
"github.com/radovskyb/watcher"
|
"github.com/radovskyb/watcher"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -127,9 +128,9 @@ func (e *Executor) registerWatchedFiles(w *watcher.Watcher, calls ...taskfile.Ca
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range task.Sources {
|
for _, s := range task.Sources {
|
||||||
files, err := zglob.Glob(s)
|
files, err := status.Glob(task.Dir, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("task: %s: %w", s, err)
|
||||||
}
|
}
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
absFile, err := filepath.Abs(f)
|
absFile, err := filepath.Abs(f)
|
||||||
|
|||||||
Reference in New Issue
Block a user