1
0
mirror of https://github.com/go-task/task.git synced 2024-12-12 10:45:49 +02:00
Commit Graph

300 Commits

Author SHA1 Message Date
Pete Davison
f6a24fe925
feat: added basic merge template function (#1438) 2024-01-11 14:29:14 +00:00
Pete Davison
7cb45a23b6 refactor: orderedmap package -> omap 2024-01-11 14:00:30 +00:00
Pete Davison
00896a1318
feat: add spew function to templater (#1452) 2024-01-10 22:04:45 -03:00
Andrey Nering
d797836cb8
chore(deps): upgrade x/exp/slices (#1462) 2024-01-11 01:02:05 +00:00
Pete Davison
247c2586c2
refactor: taskfile/ast package (#1450)
* refactor: ast package

* feat: read -> taskfile

* refactor: taskfile.Taskfile -> taskfile.Read

* refactor: move merge function back into taskfile package

* refactor: rename taskfile.go to read.go
2023-12-29 20:32:03 +00:00
Pete Davison
2b67d05b9d
feat: remove v2 support (#1447)
* feat: remove v2 support

* docs: update v2 schema docs
2023-12-29 20:26:02 +00:00
Pete Davison
39a4b4d413
fix: variable propagation (#1437) 2023-12-21 16:04:45 +00:00
Pete Davison
43a2979e77 fix: non-evaluated nil values should be converted to empty strings to avoid empty interface errors in the templater 2023-12-20 19:55:25 -06:00
Pete Davison
5516ac1a00 feat: change Var.Value from string to an any type 2023-12-20 19:55:25 -06:00
Pete Davison
de09e675c1 refactor: rename Var.Static to Var.Value 2023-12-20 19:55:25 -06:00
Pete Davison
f58257a208 feat: add any variable experiment flag 2023-12-20 19:55:25 -06:00
Pete Davison
c5a2e92e5e feat: add aliases to --json output 2023-12-20 21:54:52 -03:00
Pete Davison
ec35d43677
feat: support negative globs (#1324)
Co-authored-by: Andrey Nering <andrey@nering.com.br>
2023-11-29 22:38:12 -03:00
Andrey Nering
b681ef9868
fix(platforms): do not run dynamic vars for other platforms (#1377) 2023-10-22 00:42:26 +00:00
Pete Davison
dc77286282
feat: unify prompts (#1344) 2023-10-07 21:55:43 +00:00
Andrey Nering
72d77eb6c0
chore(deps): upgrade slim-sprig to v3.0.0 (#1329) 2023-09-14 01:59:35 +00:00
Reilly Brogan
1417f9f6cd
feat(checksum): replace md5 with xxh3 to improve performance (#1325) 2023-09-13 21:26:48 -03:00
Pete Davison
22ce67c5e5
feat: remote taskfiles (HTTP) (#1152)
* feat: remote taskfiles over http

* feat: allow insecure connections when --insecure flag is provided

* feat: better error handling for fetch errors

* fix: ensure cache directory always exists

* fix: setup logger before everything else

* feat: put remote taskfiles behind an experiment

* feat: --download and --offline flags for remote taskfiles

* feat: node.Read accepts a context

* feat: experiment docs

* chore: changelog

* chore: remove unused optional param from Node interface

* chore: tidy up and generalise NewNode function

* fix: use sha256 in remote checksum

* feat: --download by itself will not run a task

* feat: custom error if remote taskfiles experiment is not enabled

* refactor: BaseNode functional options and simplified FileNode

* fix: use hex encoding for checksum instead of b64
2023-09-12 22:42:54 +01:00
Andrey Nering
e96712b020
fix: make sure USER_WORKING_DIR works corrently with includes (#1309)
Closes #1046
Closes #1205
Closes #1250
Closes #1293
Closes #1274
Closes #1309
Closes #1312

Co-authored-by: Marcus Spading <ms@fragmentum.net>
2023-08-26 21:06:50 +00:00
Pete Davison
ca72f3c3a1 feat: added joinPath and relPath functions 2023-07-24 22:05:40 -03:00
Pete Davison
7ff1b1795e feat: for 2023-07-24 22:05:40 -03:00
Pete Davison
4e6ec14223
fix: ignore all errors when reading dotenv for experiments (#1245) 2023-06-30 09:33:37 -03:00
Pete Davison
46f7bba90d
feat: experiments flag (#1242) 2023-06-30 01:29:28 +00:00
Andrey Nering
a2f8adbb5c fix(interp): move from deprecated ExecHandler to the new ExecHandlers 2023-06-29 21:57:58 -03:00
Pete Davison
5fdaa9aa36
feat: implement gentle force experiment draft (#1216)
* feat: implement gentle force experiment draft

* docs: changelog
2023-06-18 02:32:18 +01:00
Pete Davison
d8a12fe56d
Support for experiment env vars (#1214)
* feat: experiments env var handling

* feat: read experiments from dotenv files

* docs: removed experimental cli flags

* feat: use vars instead of struct with reflection
2023-06-18 01:04:05 +00:00
Andrey Nering
44aaec86a1 chore: improvements on #1163 + changelog entry 2023-06-03 22:33:22 -03:00
Andrew Berry
082cdcc358
fix: only rewrite checksum files if the checksum has changed 2023-06-03 19:20:08 -03:00
Pete Davison
8cfac5a25a
refactor: remove newlines from formatter print functions (#1137) 2023-04-26 21:20:06 -03:00
Pete Davison
b42299a5aa
feat: use mockery/testify for mocking instead of mockgen/gomock (#1118) 2023-04-15 17:27:14 -03:00
Pete Davison
f22389a824
feat: implement task sorting with --sort flag (#1105)
* refactor: move deepcopy into its own package

* feat: add generic orderedmap implementation

* refactor: implement tasks with orderedmap

* feat: implement sort flag for all task outputs

* refactor: implement vars with orderedmap

* chore: docs

* fix: linting issues

* fix: non deterministic behavior in tests
2023-04-06 12:07:57 +01:00
Pete Davison
719f30219b
refactor: use require for testing errors (#1100) 2023-04-06 11:18:41 +01:00
Pete Davison
09c9094a6b feat: enforce gofumpt linter 2023-04-05 21:55:42 -03:00
Pete Davison
aab51c331f refactor: enable gofmt linter and fix all issues
- also rewrite 'interface{}' as 'any'
2023-04-05 21:55:42 -03:00
Pete Davison
738ffde962
fix: checksum variable in status is incorrect (#1080)
* fix: checksum variable in status is incorrect

* chore: changelog
2023-03-23 16:09:16 -05:00
Pete Davison
e40d2eec9e
feat: add task location data to json output (#1056)
* feat: add task location data to json output

* feat: add root taskfile location to --json output
2023-03-17 12:34:06 +00:00
Dhanu Saputra
9c3ee234f1
Add splitArgs template function (#1059) 2023-03-16 21:38:24 -03:00
Pete Davison
0838d48ee3
refactor: decouple fingerprinting from executor (#1039) 2023-03-10 15:27:30 -03:00
Dennis Jekubczyk
88d644a7e9
Add ability to set error_only: true on the group output mode 2023-03-08 22:34:52 -03:00
João Pedro
ec2110e58f Add new TASK_VERSION special variable
Closes #1014
Closes #990
2023-02-22 22:08:38 -03:00
Aleksandr Komlev
9af056e746
Add FORCE_COLOR env support (#1003) 2023-02-16 21:12:44 -03:00
Andrey Nering
cb393ccd3a Add CHANGELOG entry + small adjustments to #977 2023-01-14 17:18:26 -03:00
Amin Yahyaabadi
347fcf9f67
fix: avoid reruns when the timestamp method is used (#977) 2023-01-14 17:17:36 -03:00
Pete Davison
1c1be683ab
feat: set and shopt directives (#929)
Co-authored-by: Andrey Nering <andrey@nering.com.br>
2023-01-14 16:41:56 -03:00
Andrey Nering
2efb3533ec Add CHANGELOG + improvements to #980
Closes #978
2023-01-06 21:39:57 -03:00
Pete Davison
e4158dc5e4
feat: add local-prefixes flag to goimports linter (#958) 2022-12-18 22:06:09 -03:00
Andrey Nering
87ec78fbaa Cleanup: Remove duplicated internal/sleepit/main.go file 2022-12-17 11:01:54 -03:00
David Alpert
321f7b59d8
Add --json flag to be used by editor extensions (#936) 2022-12-17 10:31:00 -03:00
Pete Davison
b3627fcb18
Run Taskfiles from sub/child directories (#920) 2022-12-05 21:58:20 -03:00
Andrey Nering
44aa2ee3b3 Add CHANGELOG and improvements to #887 2022-10-14 19:48:45 -03:00
Pete Davison
376a6182eb feat: aliases
feat: add aliases to --list and --list-all flags

feat: add aliases to --summary

feat: enable aliases for included tasks

tests: added alias unit tests
2022-10-07 11:11:14 +00:00
Pete Davison
8ce1782380 feat: add coloured output to --list, --list-all and --summary flags
feat: add coloured output to --list and --list-all

feat: add coloured output to --summary

chore: update colors

refactor: better consistency in writer calls in printTasks

feat: subtasks are printed green in --summary
2022-10-07 09:54:17 +00:00
Andrey Nering
f45dd11e53 Add ROOT_DIR and TASKFILE_DIR special variables
Closes #215
2022-09-03 18:14:54 -03:00
Andrey Nering
beb927f7b4
Merge pull request #831 from ilewin/check_path_for_symlinks_issue_826
Attempt to fix Task not following symlinks
2022-08-23 18:38:17 -03:00
ilewin
2a67499f12 Issue #826. Replaced zglob.Glob func with GlobFollowSymlinks to evaluate symlinks 2022-08-23 18:25:11 +02:00
Oleg Kovalov
b08eac58e9
Fix go-critic suggestions 2022-08-17 19:37:58 +02:00
Andrey Nering
c4e10ef0aa Refactor: Add SmartJoin to handle IsAbs automatically 2022-08-06 18:19:07 -03:00
Andrey Nering
fedb68cde7 Allow override the .task dir location with the TASK_TEMP_DIR env 2022-07-08 14:40:10 -03:00
Alexander Mancevice
f54fef7e7b Allow users to override colors using environment variables
Closes #568
Closes #792
2022-07-06 11:46:59 -03:00
Andrey Nering
e36c77aaf3 Fix bug with STDOUT and STDERR in the "group" output mode
Took the oportunity to refactor a bit how we handle closing of the streams.

Fixes #779
2022-07-06 10:45:07 -03:00
Andrey Nering
7989f73f06 Fix behavior of interrupt (SIGINT, SIGTERM) signals
Task will now give time for the processes running to do cleanup work

Ref #458
Ref #479
Fixes #728

Co-authored-by: Marco Molteni <marco.molteni@pix4d.com>
Co-authored-by: aliculPix4D <aleksandar.licul_ext@pix4d.com>
2022-06-11 22:43:22 -03:00
Andrey Nering
d450444596 Temporarily revert #479 2022-05-22 16:54:35 -03:00
Andrey Nering
9e1d4e7855 Add golangci-lint
https://golangci-lint.run/
2022-05-15 21:30:07 -03:00
aliculPix4D
367c0b38a6 fix: remove redundant newline (linter error) 2022-05-13 17:36:52 -07:00
Marco Molteni
22dfc1e265 execext.RunCommand: fix: do not pass a cancellable context to mvdan.cc/sh
We used to pass to mvdan.cc/sh/interp.Runner a context that was cancelled on
reception of a OS signal. This caused the Runner to terminate the subprocess
abruptly.

The correct behavior instead is for us to completely ignore the signal and let
the subprocess deal with it. If the subprocess doesn't handle the signal, it
will be terminated. If the subprocess does handle the signal, it knows better
than us wether it wants to cleanup and terminate or do something different.

So now we pass an empty context just to make the API of interp.Runner happy

Fixes go-task/task/#458
2022-05-13 17:36:52 -07:00
Marco Molteni
bffb6e1a07 add regression test for SIGINT behavior
See go-task/task/#458

Helper (sleepit) and test code based on https://github.com/marco-m/timeit
2022-05-13 17:36:52 -07:00
Andrey Nering
1acd59c7d6 Replace \r\n on Windows as we do for \n on Linux
Closes #717
2022-05-08 17:37:24 -03:00
Andrey Nering
de09843467 Improvements + CHANGELOG for #677 2022-03-19 18:41:03 -03:00
Andrey Nering
b323531dd5 Improvements and CHANGELOG for #651 2022-02-19 19:31:27 -03:00
Jay Anslow
74f5cf8f29
Add support for begin/end messages with grouped output
Fixes #647

This allows CI systems that support grouping (such as with [GitHub Actions's `::group::` command](https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#grouping-log-lines) and [Azure Devops](https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#formatting-commands)) to collapse all of the logs for a single task, to improve readability of logs

## Example

The following Taskfile

```
# Taskfile.yml
version: 3
output:
  group:
    begin: "::group::{{ .TASK }}"
    end: "::endgroup::"
tasks:
  default:
    cmds:
      - "echo 'Hello, World!'"
```

Results in the following output
```bash
$ task
task: [default] echo 'Hello, World!'
::group::default
Hello, World!
::endgroup::
```

See [this GitHub Actions job](https://github.com/janslow/task/runs/4811059609?check_suite_focus=true) for a full example

<img width="771" alt="image" src="https://user-images.githubusercontent.com/1253367/149429832-6cb0c1b5-0758-442e-9375-c4daa65771bc.png">
<img width="394" alt="image" src="https://user-images.githubusercontent.com/1253367/149429851-1d5d2ab5-9095-4795-9b57-f91750720d40.png">
2022-01-14 00:22:14 +00:00
Andrey Nering
f945fa60d9 Merge branch 'bugfix/issue-481-dynamic-vars-broken' of https://github.com/masaushi/task into masaushi-bugfix/issue-481-dynamic-vars-broken 2022-01-04 17:39:14 -03:00
nichady
9a5d49774e replace usages of ioutil with io and os 2021-12-20 20:00:34 -06:00
Andrey Nering
3cfe21af58 Add shellQuote template function 2021-10-02 18:29:07 -03:00
masaushi
93dcb20e12 fix error in evaluating dynamic variables with newly created directory 2021-09-26 22:30:32 +09:00
Ross Hammermeister
2da38a5bdc Cleaning up the run code 2021-07-31 19:36:40 -03:00
Ross Hammermeister
97c85e39c3 Only run task once for #53 2021-07-31 19:36:40 -03:00
Andrey Nering
824b0c0132 Improve error message 2021-07-10 19:33:36 -03:00
Nicolas Fouché
08265ed1d7 Allow vars in dotenv paths, including environment variables
Closes #453
Closes #434
Ref #433

Co-authored-by: Andrey Nering <andrey@nering.com.br>
2021-06-05 16:00:19 -03:00
Andrey Nering
4e1f2ad017 Enforce NO_COLOR=1 on tests to make sure it passes
Closes #459
Fixes #480
Ref #343
Ref fatih/color#137
2021-05-30 22:48:48 -03:00
Landon Dyck
b825ad6a12 use status.Glob for watch globbing 2021-05-08 15:02:08 -05:00
Andrey Nering
e6c4706b73 Add support for delegating CLI arguments with "--" and a special CLI_ARGS variable
Closes #327
2021-03-20 11:58:45 -03:00
Andrey Nering
bf6d0c0a74 Improve performance of --list and --summary flags
Closes #332
2021-01-12 12:03:04 -03:00
Andrey Nering
e086b654aa Environment from .env file should be available as variables
Fixes #379
2021-01-12 11:11:40 -03:00
Andrey Nering
4afc0e8ed0 Fixed some bugs and regressions regarding dynamic variables and directories
Closes #426
2021-01-09 13:51:06 -03:00
Andrey Nering
141b377b4e Partly revert 59d2733b88
Keep the old behavior on v2
2021-01-09 10:55:18 -03:00
Andrey Nering
83d25bfa00 Refactor: Fix import order
It should be: stdlib > libs > app
2021-01-07 11:48:33 -03:00
Andrey Nering
ec4cd5ed48 Fix .task directory location
Closes #247
2021-01-07 11:36:09 -03:00
Andrey Nering
59d2733b88 Make dynamic variables run on the right directory
It was always running in the main Taskfile dir, even when the variable was
declared in an included taskfile in another directory or when task had a
custom dir.

Closes #384
2021-01-07 11:26:11 -03:00
Andrey Nering
2d52485d7b Watch: Clear vars cache between runs
Closes #365
2021-01-05 11:19:34 -03:00
Andrey Nering
22fd74846d Use interp.Params("-e") intead of running "set -e" manually
This is an improvement for ac8e344173
2021-01-01 17:32:42 -03:00
Andrey Nering
ac8e344173 Run "set -e" automatically for every command
Without this, multiline command strings won't always exit when they fail.

Closes #403
2020-12-27 17:15:12 -03:00
Andrey Nering
16fad60833 execext: Small refactor 2020-12-27 16:51:00 -03:00
Damian Szulc
47dd9b5a03 Move args and taskfile packages to root directory 2020-08-19 10:59:58 +02:00
Andrey Nering
6ff3c9015b On v3, treat all CLI variables as global variables
Closes #336
Ref #341

Co-authored-by: Egor Kovetskiy <e.kovetskiy@gmail.com>
2020-08-16 21:27:11 -03:00
Andrey Nering
fb72b46a3c github.com/go-task/task/v2 -> github.com/go-task/task/v3 2020-08-16 15:48:19 -03:00
Andrey Nering
eab14b6c49 Some improvements to #356 2020-08-15 19:13:30 -03:00
Chris Garrett
8b962fb8e8 #324 implement dotenv 2020-08-03 16:18:38 -06:00
Adam Wasila
9f83311931 Add label field to task definition
Label is an alternative name for task that replace it when printed in following context eg.:

- log: when given task is up to date and is skipped from execution
- log: when given task is NOT up to date (`--status` command)
- in `--summary` and `--list` commands output
2020-06-14 13:42:20 +02:00
Andrey Nering
f4f6efa547 Skip cleanup if task doesn't have any sources listed
Ref #333
2020-05-31 15:48:23 -03:00
Andrey Nering
9f0f18c5c4 v3: Allow interpolation on "includes"
The idea is to allow manual inclusion of a OS-dependant Taskfile, since it's
not automatically included anymore.
2020-05-17 16:03:03 -03:00