mirror of
https://github.com/go-task/task.git
synced 2026-05-18 21:26:37 +02:00
Compare commits
1108 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35599af04b | ||
|
|
a74b35379e | ||
|
|
7d16c9f68d | ||
|
|
890759cc5f | ||
|
|
e710e2cc5d | ||
|
|
d787faece4 | ||
|
|
9702109ea9 | ||
|
|
e547829505 | ||
|
|
a664a26062 | ||
|
|
fa105a8a93 | ||
|
|
3a0c7a8c36 | ||
|
|
13f4b376e8 | ||
|
|
5a08409a27 | ||
|
|
9bbdac3c2e | ||
|
|
a990ffe53d | ||
|
|
3a4b347d50 | ||
|
|
b80e1e4a43 | ||
|
|
fd71dfda6a | ||
|
|
fdbcbd395d | ||
|
|
dba964b559 | ||
|
|
8e0816a09d | ||
|
|
405b79f86c | ||
|
|
620e6955e5 | ||
|
|
a4997dd54d | ||
|
|
3efa9ac8c3 | ||
|
|
fdd52d74e9 | ||
|
|
ac81dea3ec | ||
|
|
549c37ef87 | ||
|
|
6a369ee31c | ||
|
|
2e573d37ae | ||
|
|
394afe2633 | ||
|
|
99ed3001f0 | ||
|
|
9e4cab2af9 | ||
|
|
33b6927b79 | ||
|
|
852a176e1f | ||
|
|
7511249514 | ||
|
|
3429cdd8af | ||
|
|
a1cd8eafd8 | ||
|
|
fbfb4ba9c4 | ||
|
|
ba9ba63792 | ||
|
|
460b89ce51 | ||
|
|
a4ec6e5257 | ||
|
|
44aa2ee3b3 | ||
|
|
80b417c4ab | ||
|
|
6d90c781c9 | ||
|
|
c51f04eca8 | ||
|
|
dda2004753 | ||
|
|
297f9eccea | ||
|
|
d2f2cba6d8 | ||
|
|
172d71435a | ||
|
|
bb1aec8a7e | ||
|
|
476d9f5e70 | ||
|
|
99014ad38d | ||
|
|
403456d3dc | ||
|
|
6335878317 | ||
|
|
6bff658af0 | ||
|
|
b111e7bd12 | ||
|
|
3e5ee2332a | ||
|
|
66f6998c86 | ||
|
|
f2a8f8ad8f | ||
|
|
540f6ecfdb | ||
|
|
8ec89f1bbd | ||
|
|
d33906b6e4 | ||
|
|
bb79fa1dc3 | ||
|
|
376a6182eb | ||
|
|
81de61d8db | ||
|
|
d2061ec898 | ||
|
|
077efbd2e7 | ||
|
|
8ce1782380 | ||
|
|
c2f20465ab | ||
|
|
fb0e43989d | ||
|
|
754248395c | ||
|
|
6e975ca155 | ||
|
|
79a2bc404e | ||
|
|
42a26e1741 | ||
|
|
695711e124 | ||
|
|
0d5811e502 | ||
|
|
b9d070f76b | ||
|
|
122c3f083e | ||
|
|
5d22cf4327 | ||
|
|
219d3ad193 | ||
|
|
e72157e26a | ||
|
|
50a377a7c4 | ||
|
|
9d7ddff60c | ||
|
|
081d878f86 | ||
|
|
d8dc091267 | ||
|
|
1c44d8049a | ||
|
|
a95191d29e | ||
|
|
111f6e7f18 | ||
|
|
4a5c1e9ec4 | ||
|
|
8f0893b5f7 | ||
|
|
b16e705a6c | ||
|
|
3cad318b70 | ||
|
|
8c6002cae6 | ||
|
|
0355bbaf3b | ||
|
|
2ba083a650 | ||
|
|
c79ea5a257 | ||
|
|
44706f4957 | ||
|
|
a1b3bb03ed | ||
|
|
76caa16909 | ||
|
|
160b788198 | ||
|
|
eada62f62c | ||
|
|
bd9419e6db | ||
|
|
bdd9de3001 | ||
|
|
200ba4ed04 | ||
|
|
1e8939dd58 | ||
|
|
f45dd11e53 | ||
|
|
1a0cc1d64d | ||
|
|
421cb522d9 | ||
|
|
1b18b041d6 | ||
|
|
8788703ac6 | ||
|
|
b6c25e3ad9 | ||
|
|
73eaa68cd1 | ||
|
|
beb927f7b4 | ||
|
|
cdc969cd4e | ||
|
|
2a67499f12 | ||
|
|
6a3cc79daa | ||
|
|
97d4a947ee | ||
|
|
e0e47ad9a0 | ||
|
|
b08eac58e9 | ||
|
|
11409ccf21 | ||
|
|
e3b6c97c3b | ||
|
|
d3da086ebf | ||
|
|
3507fa40f1 | ||
|
|
6f8f1f1409 | ||
|
|
c2148a359d | ||
|
|
c172185a24 | ||
|
|
1140a5c4ae | ||
|
|
3cc378c960 | ||
|
|
9b3a961303 | ||
|
|
d048555149 | ||
|
|
7533858a52 | ||
|
|
c4e10ef0aa | ||
|
|
c20842e7cd | ||
|
|
6cfdb21313 | ||
|
|
e396f4d06f | ||
|
|
47c1bb6a5b | ||
|
|
adfb0b513e | ||
|
|
98d78b9d8a | ||
|
|
a1c32a56ea | ||
|
|
6584bcf87f | ||
|
|
7ac75af622 | ||
|
|
b3c283b282 | ||
|
|
c2615dd746 | ||
|
|
789518f70d | ||
|
|
ad3008d855 | ||
|
|
3da426603f | ||
|
|
8d26e34b0a | ||
|
|
110d1d7245 | ||
|
|
f7384623df | ||
|
|
5d24e166ab | ||
|
|
d9ec5bcd24 | ||
|
|
bf9cd7625b | ||
|
|
afbf98c974 | ||
|
|
fedb68cde7 | ||
|
|
f787937a30 | ||
|
|
f54fef7e7b | ||
|
|
e36c77aaf3 | ||
|
|
de45e48c37 | ||
|
|
ef0ce8224e | ||
|
|
5b4d5387bf | ||
|
|
5c460b38c9 | ||
|
|
8b836ab446 | ||
|
|
1be1fccc76 | ||
|
|
2c1fda97f0 | ||
|
|
71f7b719b5 | ||
|
|
e39006b511 | ||
|
|
37d07d415a | ||
|
|
b80c8f78fc | ||
|
|
7707179b93 | ||
|
|
4e7d8bacdb | ||
|
|
0c46fa5a56 | ||
|
|
36aca00de3 | ||
|
|
0ec8cf1b53 | ||
|
|
4b2b713e59 | ||
|
|
cc0afce237 | ||
|
|
620f3fc919 | ||
|
|
af949ef0dd | ||
|
|
475c5dc19a | ||
|
|
71cfe2364a | ||
|
|
c1466f8aca | ||
|
|
7989f73f06 | ||
|
|
c9a582fbcc | ||
|
|
63aad1e501 | ||
|
|
16ba12239c | ||
|
|
b00ae9256b | ||
|
|
936045e01c | ||
|
|
b1570ab117 | ||
|
|
f066e3b1e0 | ||
|
|
1487c0e51b | ||
|
|
9f244b9bd9 | ||
|
|
374ec27ab5 | ||
|
|
b222c34f12 | ||
|
|
007a096632 | ||
|
|
26e02e3773 | ||
|
|
b8668ca3ce | ||
|
|
21a2f9f93b | ||
|
|
8a74141e4b | ||
|
|
752d9d5316 | ||
|
|
58c7cc5d05 | ||
|
|
a790fb7afe | ||
|
|
5836cb1728 | ||
|
|
19fd219409 | ||
|
|
43f99e0bf7 | ||
|
|
6f83f6c1b5 | ||
|
|
3f9c177d76 | ||
|
|
55dd7e20a0 | ||
|
|
bfbf29b78f | ||
|
|
1b6d421a5b | ||
|
|
112d9c4086 | ||
|
|
adb089dc78 | ||
|
|
5024d270ec | ||
|
|
f4d5abfc5b | ||
|
|
f55cf3ab8d | ||
|
|
d35141a369 | ||
|
|
d450444596 | ||
|
|
7e11815409 | ||
|
|
017cd4cd6c | ||
|
|
ac6c2ff769 | ||
|
|
c4e8ca4b32 | ||
|
|
c9aec2f281 | ||
|
|
591561f657 | ||
|
|
2ad4054133 | ||
|
|
7883977a56 | ||
|
|
d5cb842db2 | ||
|
|
03bbb0571e | ||
|
|
1d355d74ef | ||
|
|
7f9913590e | ||
|
|
9e1d4e7855 | ||
|
|
a1f9b584dc | ||
|
|
7d474db765 | ||
|
|
367c0b38a6 | ||
|
|
cacd57f72b | ||
|
|
22dfc1e265 | ||
|
|
bffb6e1a07 | ||
|
|
cdff0c60d9 | ||
|
|
f55eb3cba9 | ||
|
|
6b8d4dd101 | ||
|
|
d05e130250 | ||
|
|
d33e50f367 | ||
|
|
f3c9c53b6c | ||
|
|
7d5b9c78b1 | ||
|
|
e6a4b7bbba | ||
|
|
ad0b269d53 | ||
|
|
5472570958 | ||
|
|
4576ba4db0 | ||
|
|
efcfab0955 | ||
|
|
1acd59c7d6 | ||
|
|
4951a2bf7a | ||
|
|
95fc26d4ad | ||
|
|
b65935d6cf | ||
|
|
2155fdd756 | ||
|
|
f2abc13ce2 | ||
|
|
0f4621fb02 | ||
|
|
c6ff641f6d | ||
|
|
350f74a53d | ||
|
|
41cd7acc87 | ||
|
|
c6eea26660 | ||
|
|
61c5718663 | ||
|
|
9897f4b527 | ||
|
|
978a6e5ecb | ||
|
|
a018997ddc | ||
|
|
de09843467 | ||
|
|
78a57fdb4b | ||
|
|
0bc2fd72f0 | ||
|
|
dda5164efd | ||
|
|
3df2396b63 | ||
|
|
d3da84e724 | ||
|
|
eb61015477 | ||
|
|
40c644f006 | ||
|
|
c9aa0180a8 | ||
|
|
a06e46885d | ||
|
|
60fa6e6c0a | ||
|
|
2f18f7927d | ||
|
|
292cf75836 | ||
|
|
fc95061f4c | ||
|
|
1f1275255c | ||
|
|
d8555e5a5d | ||
|
|
b323531dd5 | ||
|
|
cfb665310e | ||
|
|
51c6ebcd4d | ||
|
|
e94d1b6b9f | ||
|
|
ca7b32105d | ||
|
|
264db2737b | ||
|
|
5f2c9a6e45 | ||
|
|
19be1f1bf0 | ||
|
|
7cdf0000d9 | ||
|
|
13606e5e00 | ||
|
|
35af240faa | ||
|
|
0ac56f8973 | ||
|
|
6e5f8b1fb0 | ||
|
|
15e831c0b0 | ||
|
|
248952bc8f | ||
|
|
2373743eac | ||
|
|
f119596be6 | ||
|
|
b7cb41b388 | ||
|
|
a65ee26446 | ||
|
|
d3e2fbf1e2 | ||
|
|
66748ab5e5 | ||
|
|
c73a2c8f84 | ||
|
|
4bbcd99b8b | ||
|
|
02e7ff27c7 | ||
|
|
7ed3cea40b | ||
|
|
74f5cf8f29 | ||
|
|
086d13ca2f | ||
|
|
2780e96179 | ||
|
|
191678f9d6 | ||
|
|
79f595d8d1 | ||
|
|
db2865fb17 | ||
|
|
f945fa60d9 | ||
|
|
454988f657 | ||
|
|
7e0346d6eb | ||
|
|
00a90d1fe6 | ||
|
|
d6c185580a | ||
|
|
fd9132c15d | ||
|
|
42702e81b3 | ||
|
|
09c9d55695 | ||
|
|
69e9effc88 | ||
|
|
1c782c599f | ||
|
|
ed37071fd6 | ||
|
|
d73cf106b1 | ||
|
|
1d7982e80a | ||
|
|
d5d1984116 | ||
|
|
9eda1629bb | ||
|
|
9a5d49774e | ||
|
|
b2efebce96 | ||
|
|
85232bd704 | ||
|
|
df4e3aea79 | ||
|
|
290d45fd05 | ||
|
|
168e8c925c | ||
|
|
d9859b18fe | ||
|
|
784847f35b | ||
|
|
97287377d1 | ||
|
|
a15b66e003 | ||
|
|
a441b4b90d | ||
|
|
0dcc1390a6 | ||
|
|
01c86636e9 | ||
|
|
846c27d579 | ||
|
|
db05059b42 | ||
|
|
b824328850 | ||
|
|
a8767a2b1a | ||
|
|
5e14e7fb70 | ||
|
|
fbaa7be52e | ||
|
|
b6016b244e | ||
|
|
e339a64261 | ||
|
|
17e18442ab | ||
|
|
e8aa3a17a6 | ||
|
|
bdb97eab86 | ||
|
|
690000254c | ||
|
|
6a0b778978 | ||
|
|
549d141053 | ||
|
|
c31ecdb8de | ||
|
|
8a09d044c7 | ||
|
|
a3b5b89930 | ||
|
|
ad6f100f6a | ||
|
|
3cfe21af58 | ||
|
|
b70a660975 | ||
|
|
04c1d1389f | ||
|
|
f12156bf81 | ||
|
|
0177ac660b | ||
|
|
361b9b4ce4 | ||
|
|
78792bd11c | ||
|
|
8b38ddfcd9 | ||
|
|
78ddf50d2d | ||
|
|
93dcb20e12 | ||
|
|
41a71e1dee | ||
|
|
a5ed8ad58c | ||
|
|
e45ed85b55 | ||
|
|
52474f9103 | ||
|
|
c2587da27d | ||
|
|
26036877b2 | ||
|
|
906cdd9050 | ||
|
|
762662d056 | ||
|
|
1de4b38766 | ||
|
|
6c73ab823b | ||
|
|
5ef1651151 | ||
|
|
8d695bc8d7 | ||
|
|
c892d055ed | ||
|
|
b327e54be1 | ||
|
|
989045489c | ||
|
|
888338c60e | ||
|
|
e6c6cc7811 | ||
|
|
fa0e72bd69 | ||
|
|
18decac44d | ||
|
|
1012a0cf2b | ||
|
|
7e4de945cf | ||
|
|
a468272726 | ||
|
|
039d8f000d | ||
|
|
2dc181c75e | ||
|
|
d35f960a8a | ||
|
|
634f8ed574 | ||
|
|
d369451308 | ||
|
|
8f1202424d | ||
|
|
0a6833e9d8 | ||
|
|
8f80fc4e2c | ||
|
|
50e5813222 | ||
|
|
7bc268aeaa | ||
|
|
537b5b1e25 | ||
|
|
aae38f8ce7 | ||
|
|
ad05432bcf | ||
|
|
8aa983257d | ||
|
|
046a97d1e5 | ||
|
|
d28649b13d | ||
|
|
3e16ca37bc | ||
|
|
2da38a5bdc | ||
|
|
bbe1d8b52e | ||
|
|
97c85e39c3 | ||
|
|
a7b59e5b12 | ||
|
|
9eb1252ce9 | ||
|
|
0e01e13670 | ||
|
|
239e61e718 | ||
|
|
22549e9fd8 | ||
|
|
1f9fd24064 | ||
|
|
a7594740e3 | ||
|
|
945c72cf6c | ||
|
|
824b0c0132 | ||
|
|
51e9f2f579 | ||
|
|
e8ec33d9d0 | ||
|
|
3bbbaf12fd | ||
|
|
30ffacd879 | ||
|
|
75e9b7791c | ||
|
|
4b665ab19a | ||
|
|
08265ed1d7 | ||
|
|
cded9af90f | ||
|
|
4e1f2ad017 | ||
|
|
7f92b7072d | ||
|
|
4a589ba6a4 | ||
|
|
7f16325fcc | ||
|
|
b62e5bf34c | ||
|
|
bd6b348cc7 | ||
|
|
62f35fe8c8 | ||
|
|
cb2cb4659c | ||
|
|
a2c58415cf | ||
|
|
2cb9987c99 | ||
|
|
36584cfb7c | ||
|
|
b825ad6a12 | ||
|
|
f8545d4c61 | ||
|
|
9b42ef5d46 | ||
|
|
05ddfc0495 | ||
|
|
53b2cebb66 | ||
|
|
58c69e36a1 | ||
|
|
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 | ||
|
|
b9aea8c5ec | ||
|
|
897619a961 | ||
|
|
e6c4706b73 | ||
|
|
8994c50d34 | ||
|
|
55b62e47eb | ||
|
|
c6ecf70377 | ||
|
|
f0cd7d27fb | ||
|
|
f923bb499b | ||
|
|
aa3a29fed2 | ||
|
|
47d3011c85 | ||
|
|
cec713a47a | ||
|
|
bf6d0c0a74 | ||
|
|
c11672fca3 | ||
|
|
e086b654aa | ||
|
|
1107f691ea | ||
|
|
b095ca5756 | ||
|
|
4afc0e8ed0 | ||
|
|
141b377b4e | ||
|
|
402a478785 | ||
|
|
73680584f3 | ||
|
|
45dbbcd179 | ||
|
|
83d25bfa00 | ||
|
|
299e27af15 | ||
|
|
ec4cd5ed48 | ||
|
|
59d2733b88 | ||
|
|
cbdd088188 | ||
|
|
2d52485d7b | ||
|
|
d830178ef8 | ||
|
|
049984b4cc | ||
|
|
d261a986ab | ||
|
|
9b2e25735b | ||
|
|
e09e75b0ba | ||
|
|
6630113fef | ||
|
|
b2f08c9c20 | ||
|
|
6a4315b7e7 | ||
|
|
8b3e62ff6d | ||
|
|
f1d3f6740d | ||
|
|
9ccd1d920c | ||
|
|
9674d75ff6 | ||
|
|
22fd74846d | ||
|
|
777645888a | ||
|
|
ac8e344173 | ||
|
|
16fad60833 | ||
|
|
cb96a39b46 | ||
|
|
a540634b5b | ||
|
|
e15576bc47 | ||
|
|
95359760ae | ||
|
|
be209cb7b6 | ||
|
|
f5eb80759b | ||
|
|
9f125502f8 | ||
|
|
3f856c4b1c | ||
|
|
f55fb1e3a5 | ||
|
|
bf88bd5da5 | ||
|
|
b7112e02db | ||
|
|
347c796662 | ||
|
|
9bed7f7a9b | ||
|
|
b136166fc9 | ||
|
|
75727c3d68 | ||
|
|
6c625b3359 | ||
|
|
60759a4e3b | ||
|
|
582a66bb2f | ||
|
|
d78f78bb5c | ||
|
|
71b7d062d5 | ||
|
|
c6138a0660 | ||
|
|
ce4ac97269 | ||
|
|
2088a86512 | ||
|
|
e296fe2b98 | ||
|
|
96b8890ecc | ||
|
|
db6fae2f5b | ||
|
|
6743cdbb65 | ||
|
|
71466c9a27 | ||
|
|
1bdf7e3192 | ||
|
|
7285f3c844 | ||
|
|
eb257d3aa7 | ||
|
|
87f11491d9 | ||
|
|
5735a02473 | ||
|
|
47dd9b5a03 | ||
|
|
7652d7889b | ||
|
|
dd2116c897 | ||
|
|
c5566b3e94 | ||
|
|
30cbf02bff | ||
|
|
9e4e9b4f1a | ||
|
|
6f290f28b6 | ||
|
|
6ff3c9015b | ||
|
|
e28b82b2b7 | ||
|
|
3edf124f96 | ||
|
|
fb72b46a3c | ||
|
|
49bf395f61 | ||
|
|
eab14b6c49 | ||
|
|
8b962fb8e8 | ||
|
|
e5a3c861cb | ||
|
|
c7bb3d63b0 | ||
|
|
e6b543c15e | ||
|
|
8137517d93 | ||
|
|
572f6a7fab | ||
|
|
c6d9201680 | ||
|
|
7dcb3af944 | ||
|
|
4bc183a8a1 | ||
|
|
9f83311931 | ||
|
|
10986d3a7c | ||
|
|
f4f6efa547 | ||
|
|
bf64259af3 | ||
|
|
6141ba84ce | ||
|
|
329902f0db | ||
|
|
bfcaa7a443 | ||
|
|
45915bf0ed | ||
|
|
ee7f2a541f | ||
|
|
59a00eae98 | ||
|
|
df8293bee6 | ||
|
|
935216f179 | ||
|
|
f56bbd46fd | ||
|
|
9f0f18c5c4 | ||
|
|
191c34c9c4 | ||
|
|
6a604b3002 | ||
|
|
5a435b533e | ||
|
|
4b027722b1 | ||
|
|
68ce8642b1 | ||
|
|
4913b6a0f1 | ||
|
|
aee0ab05f4 | ||
|
|
b44432f24a | ||
|
|
86be13ff1f | ||
|
|
ee95df0e57 | ||
|
|
442c29f020 | ||
|
|
739037fc37 | ||
|
|
f8252020aa | ||
|
|
38b87439fe | ||
|
|
116879f7ea | ||
|
|
2eafb2f067 | ||
|
|
c36f0f6f7f | ||
|
|
bfc033959b | ||
|
|
814f350b6d | ||
|
|
05db8ce582 | ||
|
|
3fd36a0c72 | ||
|
|
cbb12b29bd | ||
|
|
6ed30f1add | ||
|
|
a044c41c66 | ||
|
|
fb78e53a14 | ||
|
|
acfbbaa549 | ||
|
|
d52d74c64c | ||
|
|
d36f73de01 | ||
|
|
628c4a7b5f | ||
|
|
ca07a663e1 | ||
|
|
66d008391e | ||
|
|
eef84bda26 | ||
|
|
e0defe71aa | ||
|
|
069257151e | ||
|
|
3f80a3b39e | ||
|
|
b2a56161bb | ||
|
|
5e75639244 | ||
|
|
cb2cd3e10f | ||
|
|
0acb911d6a | ||
|
|
17ad7060b3 | ||
|
|
f38ba7fcd3 | ||
|
|
a3464068bd | ||
|
|
347ecc028f | ||
|
|
94ac60fa09 | ||
|
|
d567e23e50 | ||
|
|
8ff81562d2 | ||
|
|
7a8142ed92 | ||
|
|
eaba1b9cc8 | ||
|
|
b08b3546d2 | ||
|
|
7453e688fd | ||
|
|
32b097b3f2 | ||
|
|
22394def78 | ||
|
|
68ecb7fbdd | ||
|
|
de98a53b43 | ||
|
|
1c9fbf92c6 | ||
|
|
c068b05232 | ||
|
|
15338ecb18 | ||
|
|
01e9a8f720 | ||
|
|
4bdfe64afb | ||
|
|
b7b752b92f | ||
|
|
b7bcd204b4 | ||
|
|
ec934ba3c0 | ||
|
|
7373639f57 | ||
|
|
d718527a1f | ||
|
|
48add0f293 | ||
|
|
a4685229c9 | ||
|
|
f0bc4d26a0 | ||
|
|
1d3b93d88d | ||
|
|
62752ba7e1 | ||
|
|
6a4f420187 | ||
|
|
6640632683 | ||
|
|
09d5d802d0 | ||
|
|
fea23ed6d4 | ||
|
|
10a6c4dc7a | ||
|
|
4cdaa72224 | ||
|
|
27bc1ca5d1 | ||
|
|
1ea49188c9 | ||
|
|
3084ef129c | ||
|
|
c0d112f858 | ||
|
|
2265dda84c | ||
|
|
263b094cab | ||
|
|
fbd13614a5 | ||
|
|
9eab74b595 | ||
|
|
5acdb041a9 | ||
|
|
0494d7ebe3 | ||
|
|
9a8442c946 | ||
|
|
e1dcd0b441 | ||
|
|
a152db7054 | ||
|
|
b9e092674e | ||
|
|
4162b5f41d | ||
|
|
67ae6f210f | ||
|
|
f6c5a46626 | ||
|
|
d6f7e01c53 | ||
|
|
46463e4e24 | ||
|
|
bc99509395 | ||
|
|
5c420f3a34 | ||
|
|
393712ead2 | ||
|
|
d3060b0060 | ||
|
|
14d7f04a81 | ||
|
|
1a28e5e0d4 | ||
|
|
884cd0d636 | ||
|
|
6a7a3c0ae8 | ||
|
|
948e6bd57c | ||
|
|
78595fba0b | ||
|
|
8020284b12 | ||
|
|
d6a49da870 | ||
|
|
84da80356d | ||
|
|
bcbb85eac3 | ||
|
|
0e1d8a72e6 | ||
|
|
bbdd698869 | ||
|
|
bae1e1ee9f | ||
|
|
7138785500 | ||
|
|
8f684ffa6d | ||
|
|
9be3666fe7 | ||
|
|
b7785678f4 | ||
|
|
d8005b4cf6 | ||
|
|
52028fc3bc | ||
|
|
5285ec23ae | ||
|
|
3c882e5c57 | ||
|
|
1a33f9168b | ||
|
|
ccae3d7383 | ||
|
|
847651a90a | ||
|
|
1b8998e7a2 | ||
|
|
dc8fb79759 | ||
|
|
6b0935d6cf | ||
|
|
d1183ce272 | ||
|
|
a1aec8178a | ||
|
|
ad569a8a36 | ||
|
|
0d9fdbaac1 | ||
|
|
f5cd3eab9e | ||
|
|
cb6fe4bb59 | ||
|
|
db36bc67f1 | ||
|
|
e0f72a6193 | ||
|
|
1ee684b7c0 | ||
|
|
93005512b4 | ||
|
|
8987cd64a0 | ||
|
|
fac51dcf03 | ||
|
|
01101a4c9b | ||
|
|
d561e40817 | ||
|
|
b8094fd771 | ||
|
|
af5d9c952d | ||
|
|
ce4e187cbc | ||
|
|
821c80b61e | ||
|
|
5a6fb7c973 | ||
|
|
0cb298ebdf | ||
|
|
0f385f9f4e | ||
|
|
a149368725 | ||
|
|
afeefe8259 | ||
|
|
690d3c27a2 | ||
|
|
3d56ea5ce5 | ||
|
|
fdff7f80a3 | ||
|
|
fe6978b107 | ||
|
|
57db6865d2 | ||
|
|
d235d5ab28 | ||
|
|
c47c15ee47 | ||
|
|
613dfe06d3 | ||
|
|
6803ad2e59 | ||
|
|
d5a791b470 | ||
|
|
a312d61d68 | ||
|
|
e414c1f7b0 | ||
|
|
955359b073 | ||
|
|
26e0c0887a | ||
|
|
4c295b564a | ||
|
|
2eb52da0db | ||
|
|
d8bfb3ab13 | ||
|
|
d970e93507 | ||
|
|
e6255081a8 | ||
|
|
623db0ed94 | ||
|
|
0e575e9c25 | ||
|
|
fb23ba9878 | ||
|
|
4e09fc7f43 | ||
|
|
64cfdd815f | ||
|
|
f6f31e0a8d | ||
|
|
bd5fb9be03 | ||
|
|
762714de68 | ||
|
|
82a3651a18 | ||
|
|
dd9cdb0ec9 | ||
|
|
7f082a821d | ||
|
|
abe0352de9 | ||
|
|
4cee4aa5a8 | ||
|
|
9c68c7c50b | ||
|
|
0608782cfa | ||
|
|
edeaf3794a | ||
|
|
fe2b8c8afa | ||
|
|
b66bf58064 | ||
|
|
957dfa9cdf | ||
|
|
cc9264854e | ||
|
|
d1463b3e24 | ||
|
|
f1082520e1 | ||
|
|
733c563194 | ||
|
|
0200d043c3 | ||
|
|
9c475c36e7 | ||
|
|
c663c5c507 | ||
|
|
1e93c38307 | ||
|
|
81baf808c9 | ||
|
|
74537689dc | ||
|
|
12ab01d5e6 | ||
|
|
044d3a0ff9 | ||
|
|
659cae6a4c | ||
|
|
8efc38ad82 | ||
|
|
bd5882f0f0 | ||
|
|
6ff9ba9df9 | ||
|
|
b2df398a12 | ||
|
|
83d618e1eb | ||
|
|
f0768b3af1 | ||
|
|
0233ce52ed | ||
|
|
6e6f337509 | ||
|
|
1546415b8f | ||
|
|
20725c69bf | ||
|
|
90613220c6 | ||
|
|
659fd2ae93 | ||
|
|
29d899f7da | ||
|
|
902a0a01a9 | ||
|
|
8001fb3915 | ||
|
|
e81e2802f0 | ||
|
|
1ee066ec42 | ||
|
|
53d54d1c4a | ||
|
|
10082b60b8 | ||
|
|
c5b9773922 | ||
|
|
de11323d28 | ||
|
|
9f269e1a95 | ||
|
|
e4204168a0 | ||
|
|
9c350f8ef1 | ||
|
|
db19fdac29 | ||
|
|
d516b238b1 | ||
|
|
f9330f6cd9 | ||
|
|
360da29e1f | ||
|
|
9cfac1642a | ||
|
|
db90e87d10 | ||
|
|
b7564080bc | ||
|
|
1d783bf6c7 | ||
|
|
1025c2e3a1 | ||
|
|
4fd82ab222 | ||
|
|
8eadfc1bf6 | ||
|
|
f66edbad50 | ||
|
|
c7f17b5319 | ||
|
|
23c4adcef6 | ||
|
|
808542bed0 | ||
|
|
93bfd57856 | ||
|
|
7e7e1bccba | ||
|
|
34f6da86c3 | ||
|
|
15c0381c3c | ||
|
|
c2f4a57e02 | ||
|
|
f945cf2343 | ||
|
|
5bca3cfd71 | ||
|
|
26ce4e6886 | ||
|
|
f5f0e0c376 | ||
|
|
9dea1e7f3e | ||
|
|
c2e0f8c81f | ||
|
|
d341bc25ce | ||
|
|
0379e2b51b | ||
|
|
e79026b840 | ||
|
|
fc34d6b56f | ||
|
|
2a1571a99e | ||
|
|
c158608255 | ||
|
|
3ca590b185 | ||
|
|
3f8ee21849 | ||
|
|
845b88a193 | ||
|
|
e252972c7f | ||
|
|
a9012ebfc5 | ||
|
|
5cfd9bbbbd | ||
|
|
c82a7240bb | ||
|
|
a4a20d92a4 | ||
|
|
890996f595 | ||
|
|
474f27c6d3 | ||
|
|
33f3894372 | ||
|
|
24436ac76e | ||
|
|
3ee66ef705 | ||
|
|
a1765e1d33 | ||
|
|
765e3dbf72 | ||
|
|
80f5cee599 | ||
|
|
4dcb124693 | ||
|
|
31ecf167cc | ||
|
|
3999480d64 | ||
|
|
9dbb503c23 | ||
|
|
a98f803d87 | ||
|
|
9e9ffeb5d5 | ||
|
|
33d4ad4d84 | ||
|
|
d05d418c4c | ||
|
|
06d0af7a1d | ||
|
|
9a3b726068 | ||
|
|
2676ab9a59 | ||
|
|
a1837d553e | ||
|
|
fdbc130d8d | ||
|
|
4b3cea3812 | ||
|
|
1c3082ffa6 | ||
|
|
0446cfdba0 | ||
|
|
db1d3183b6 | ||
|
|
fb666394fc | ||
|
|
1054c89a9d | ||
|
|
8dd87dc482 | ||
|
|
b2edbf05a1 | ||
|
|
6fb53a406b | ||
|
|
b05fa0821d | ||
|
|
0a808b1212 | ||
|
|
f1d83e92a7 | ||
|
|
31b60f7f60 | ||
|
|
c0f9af5daa | ||
|
|
b25a9e8884 | ||
|
|
3c0cf3cd55 | ||
|
|
1ac6f17e6a | ||
|
|
399a2b38f3 | ||
|
|
b97221cdb2 | ||
|
|
0164bc21ea | ||
|
|
5a23250d32 | ||
|
|
80d88d9789 | ||
|
|
31ead854c7 | ||
|
|
4b64fcb8a4 | ||
|
|
a951f2403d | ||
|
|
f9adeba7f1 | ||
|
|
5c823d51d0 | ||
|
|
9be7521b83 | ||
|
|
c73ddc3552 | ||
|
|
4b7f058f41 | ||
|
|
07221a1b20 | ||
|
|
13614fb3c4 | ||
|
|
4fa983bde7 | ||
|
|
9cb1db8c0a | ||
|
|
5738436d55 | ||
|
|
5e49b38c33 | ||
|
|
0c94adaff9 | ||
|
|
f8a6c5d06c | ||
|
|
21e66c7c02 | ||
|
|
902f0d3ac4 | ||
|
|
713ecd35f6 | ||
|
|
27b35157cd | ||
|
|
f8fb639870 | ||
|
|
14f41ae619 | ||
|
|
a026d72924 | ||
|
|
2cb070f5b3 | ||
|
|
1dec956e99 | ||
|
|
310394aa60 | ||
|
|
468ff18243 | ||
|
|
44a63580f0 | ||
|
|
4ac1fa43aa | ||
|
|
6f992a3cf7 | ||
|
|
fd4ce656d5 | ||
|
|
9ed2dca427 | ||
|
|
dfb804fe3f | ||
|
|
4f2a84b426 | ||
|
|
14a127b6b3 | ||
|
|
06000533fb | ||
|
|
7722aba403 | ||
|
|
4817d8c67f | ||
|
|
9a062d90d1 | ||
|
|
959eb45373 | ||
|
|
a42f2af9eb | ||
|
|
4ddad68212 | ||
|
|
aac6c5a1c7 | ||
|
|
5572e31fd4 | ||
|
|
233b8bf81a | ||
|
|
2ae3810f80 | ||
|
|
736165876c | ||
|
|
61b3fca9a3 | ||
|
|
469863b7b3 | ||
|
|
5238bc55fd | ||
|
|
57a01aa6ff | ||
|
|
9361dbc39e | ||
|
|
11d257cb26 | ||
|
|
a928ab75e3 | ||
|
|
55a240c82e | ||
|
|
f8aedf438b | ||
|
|
9f1bb9a42e | ||
|
|
0ed7274610 | ||
|
|
df032b09a7 | ||
|
|
7dba742e4c | ||
|
|
83dbe78965 | ||
|
|
95b75c5330 | ||
|
|
780bd08490 | ||
|
|
a9b1f38a7c | ||
|
|
4ed4ad9852 | ||
|
|
81f172315c | ||
|
|
54666221a4 | ||
|
|
5327d702f8 | ||
|
|
a701ea3007 | ||
|
|
f0fb7d9661 | ||
|
|
3cbc89769d | ||
|
|
cb95200be3 | ||
|
|
a52f6c0acf | ||
|
|
77f9e3dd41 | ||
|
|
259d3e2df1 | ||
|
|
6eee5421b0 | ||
|
|
8004e9c943 | ||
|
|
2ab8511f45 | ||
|
|
7514ff53c9 | ||
|
|
309cfb1499 | ||
|
|
a567f7ed20 | ||
|
|
5720936247 | ||
|
|
5d9de14ca3 | ||
|
|
f519f56078 | ||
|
|
5eb1a1f7f5 | ||
|
|
5a28560177 | ||
|
|
db280adf55 | ||
|
|
b77fcd6c8a | ||
|
|
b5b2649283 | ||
|
|
318f9b216d | ||
|
|
61247a0b2a | ||
|
|
849a418273 | ||
|
|
2e63a62e08 | ||
|
|
6ccf1f2a3c | ||
|
|
e298256b82 | ||
|
|
787e5b2e29 | ||
|
|
4aa1e8b093 | ||
|
|
9ee224c36b | ||
|
|
08263c0597 | ||
|
|
347fe87229 | ||
|
|
b65a0a3a8d | ||
|
|
9a5a1e2253 | ||
|
|
687b4ec837 | ||
|
|
8bdf5c554d | ||
|
|
f4a18e531f | ||
|
|
df951a0c7c | ||
|
|
a6cac2691b | ||
|
|
a9f5179066 | ||
|
|
687e2699cf | ||
|
|
491da0ceb9 | ||
|
|
1bac40bc58 | ||
|
|
fb9061480d | ||
|
|
a04cf100b4 | ||
|
|
76253bf516 | ||
|
|
feaf70922d | ||
|
|
c70343a5bc | ||
|
|
550c116aea | ||
|
|
a5f31a4280 | ||
|
|
27fc4c4ca8 | ||
|
|
90a5f17f58 | ||
|
|
108cb91d95 | ||
|
|
00a0755ff3 | ||
|
|
3f7e8c88eb | ||
|
|
1c7ca94d49 | ||
|
|
31273cd6ff | ||
|
|
14e39dd745 | ||
|
|
cc6f7b6088 | ||
|
|
da1b0c9558 | ||
|
|
9f294b4d10 | ||
|
|
13f60bae41 | ||
|
|
67105b332f | ||
|
|
18961e3d07 | ||
|
|
fe31f5050d | ||
|
|
ab8549adea | ||
|
|
05600601ff | ||
|
|
c541356289 | ||
|
|
467c4360ca | ||
|
|
3b152a38b0 | ||
|
|
f4d3855528 | ||
|
|
09eab770a7 | ||
|
|
102f8ab74e | ||
|
|
a830dba5da | ||
|
|
3f13a50ca3 | ||
|
|
7c456f2ab9 | ||
|
|
bae95cd6f6 | ||
|
|
bbd6e443b0 | ||
|
|
db0d847e03 | ||
|
|
0afb453fed | ||
|
|
dbc79b4311 | ||
|
|
ac6008c33c | ||
|
|
e540e752f2 | ||
|
|
cdbe821eb8 | ||
|
|
6be994f1ca | ||
|
|
a407b0a8eb | ||
|
|
051ff35878 | ||
|
|
8b3c34c308 | ||
|
|
2cb2668803 | ||
|
|
4dccdb95b9 | ||
|
|
96db9a9410 | ||
|
|
0cd34bbebc | ||
|
|
15f50c0e58 | ||
|
|
7fca9732e7 | ||
|
|
0ea8c3ed28 | ||
|
|
0af9600e92 | ||
|
|
328e3725e5 | ||
|
|
2183e1e9f5 | ||
|
|
120d0be84c | ||
|
|
5649f75a8d | ||
|
|
a209f7d6be | ||
|
|
d48a2f3ccf | ||
|
|
c1ae36866e | ||
|
|
4f368923a5 | ||
|
|
7c02097d93 | ||
|
|
51998f706f | ||
|
|
1a3df08aca | ||
|
|
975f262ac0 | ||
|
|
1cb4a3b8d5 | ||
|
|
35f4b2f686 | ||
|
|
407ec91ca7 | ||
|
|
12c0d18932 | ||
|
|
2d4ca37226 | ||
|
|
afe6744e97 | ||
|
|
19d4b8b7f7 | ||
|
|
3556942516 | ||
|
|
87a200e42c | ||
|
|
152fc0ad38 | ||
|
|
3212ae4713 | ||
|
|
040cef1479 | ||
|
|
f5f70d7a75 | ||
|
|
42509cf2f5 | ||
|
|
6f74c2d823 | ||
|
|
e23a6dc9f1 | ||
|
|
134c6b79c4 | ||
|
|
00ff1447ee | ||
|
|
78f6cb08d8 | ||
|
|
dfd890c8a6 | ||
|
|
7457b3668b | ||
|
|
71e7cd5808 | ||
|
|
57e42af238 | ||
|
|
e065dcb816 | ||
|
|
9619c7f54d | ||
|
|
2508bed363 | ||
|
|
c469632ee0 | ||
|
|
44a52359dc | ||
|
|
2022551b26 | ||
|
|
baac067a1a | ||
|
|
f4216dd67f | ||
|
|
60186bdcd5 | ||
|
|
2c2eb1684b | ||
|
|
33b167215d | ||
|
|
c53db134c6 | ||
|
|
0513a21e25 | ||
|
|
2fc32414f5 | ||
|
|
309bc4ee4c | ||
|
|
7977e6fb16 | ||
|
|
abb19dfbf8 | ||
|
|
14676dc3f8 | ||
|
|
c16f8a4d46 | ||
|
|
48bf09da21 | ||
|
|
c295a1998a |
@@ -7,8 +7,7 @@ insert_final_newline = true
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
[*.{md,yml,yaml,json,toml}]
|
||||
[*.{md,yml,yaml,json,toml,htm,html,js,css,svg,sh,bash,fish}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
6
.github/CONTRIBUTING.md
vendored
Normal file
6
.github/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
* Bug reports and feature requests are welcome in [the issues][issues]
|
||||
* Pull Requests are welcome. For more complex changes and features it's
|
||||
recommended to open an issue with the feature request first
|
||||
* Documentation contributions are as important as code contributions
|
||||
|
||||
[issues]: https://github.com/go-task/task/issues
|
||||
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
github: andreynering
|
||||
open_collective: task
|
||||
custom: 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A¤cy_code=USD&source=url'
|
||||
15
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
15
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Use this to report bugs and issues
|
||||
---
|
||||
|
||||
> Thanks for your bug report!
|
||||
>
|
||||
> Before submitting this issue, please make sure the same problem was
|
||||
> not already reported by someone else.
|
||||
>
|
||||
> Please describe the bug you're facing. Consider pasting example
|
||||
> Taskfiles showing how to reproduce the problem.
|
||||
|
||||
- Task version:
|
||||
- Operating System:
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Help forum on Discord
|
||||
url: https://discord.com/channels/974121106208354339/1025054680289660989
|
||||
about: 'The Discord #help channel is the best way to get help from the community.'
|
||||
- name: Questions, Ideas and General Discussions
|
||||
url: https://github.com/go-task/task/discussions
|
||||
about: Ask questions and discuss general ideas with the community.
|
||||
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Use this to make feature requests
|
||||
---
|
||||
|
||||
> Describe in detail what feature do you want to see in Task.
|
||||
> Give examples if possible.
|
||||
>
|
||||
> Please, search if this wasn't proposed before, and if this is more like an idea
|
||||
> than a strong feature request, consider opening a
|
||||
> [discussion](https://github.com/go-task/task/discussions) instead.
|
||||
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
|
||||
5
.github/pull_request_template.md
vendored
Normal file
5
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
> Thanks for your pull request, we really appreciate contributions!
|
||||
>
|
||||
> Please understand that it may take some time to be reviewed.
|
||||
>
|
||||
> Also, make sure to follow the [Contribution Guide](https://taskfile.dev/contributing/).
|
||||
42
.github/workflows/issue-awaiting-response.yml
vendored
Normal file
42
.github/workflows/issue-awaiting-response.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: issue awaiting response
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
issue-awaiting-response:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const issue = await github.rest.issues.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
})
|
||||
const comments = await github.paginate(
|
||||
github.rest.issues.listComments, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
}
|
||||
)
|
||||
const labels = await github.paginate(
|
||||
github.rest.issues.listLabelsOnIssue, {
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
}
|
||||
)
|
||||
if (labels.find(label => label.name === 'awaiting response')) {
|
||||
if (comments[comments.length-1].user?.login === issue.data.user?.login) {
|
||||
github.rest.issues.removeLabel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
name: 'awaiting response'
|
||||
})
|
||||
}
|
||||
}
|
||||
28
.github/workflows/issue-needs-triage.yml
vendored
Normal file
28
.github/workflows/issue-needs-triage.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: issue needs triage
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
needs-triage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const labels = await github.paginate(
|
||||
github.rest.issues.listLabelsOnIssue, {
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
}
|
||||
)
|
||||
if (labels.length === 0) {
|
||||
github.rest.issues.addLabels({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: ['needs triage']
|
||||
})
|
||||
}
|
||||
24
.github/workflows/lint.yml
vendored
Normal file
24
.github/workflows/lint.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.18.x
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: v1.46.1
|
||||
26
.github/workflows/release.yml
vendored
Normal file
26
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.19.x
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GH_PAT}}
|
||||
38
.github/workflows/test.yml
vendored
Normal file
38
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.18.x, 1.19.x]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{matrix.platform}}
|
||||
steps:
|
||||
- name: Set up Go ${{matrix.go-version}}
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{matrix.go-version}}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Download Go modules
|
||||
run: go mod download
|
||||
env:
|
||||
GOPROXY: https://proxy.golang.org
|
||||
|
||||
- name: Build
|
||||
run: go build -o ./bin/task -v ./cmd/task
|
||||
|
||||
- name: Test
|
||||
run: ./bin/task test --output=group --output-group-begin='::group::{{.TASK}}' --output-group-end='::endgroup::'
|
||||
35
.github/workflows/website-deploy.yml
vendored
Normal file
35
.github/workflows/website-deploy.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Website Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
website-deploy:
|
||||
name: Website Deploy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
cache-dependency-path: ./docs/yarn.lock
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
working-directory: ./docs
|
||||
|
||||
- name: Build website
|
||||
run: yarn build
|
||||
working-directory: ./docs
|
||||
|
||||
- name: Website Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/build
|
||||
user_name: task-bot
|
||||
user_email: 106601941+task-bot@users.noreply.github.com
|
||||
27
.github/workflows/website-test.yml
vendored
Normal file
27
.github/workflows/website-test.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Website Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
website-test:
|
||||
name: Website Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
cache-dependency-path: ./docs/yarn.lock
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
working-directory: ./docs
|
||||
|
||||
- name: Test build website
|
||||
run: yarn build
|
||||
working-directory: ./docs
|
||||
17
.gitignore
vendored
17
.gitignore
vendored
@@ -14,6 +14,21 @@
|
||||
.glide/
|
||||
|
||||
./task
|
||||
.task
|
||||
dist/
|
||||
|
||||
vendor/**/*_test.go
|
||||
.DS_Store
|
||||
|
||||
# editors
|
||||
.idea/
|
||||
.vscode/
|
||||
.fleet/
|
||||
|
||||
# exuberant ctags
|
||||
tags
|
||||
|
||||
/bin/*
|
||||
!/bin/.keep
|
||||
/testdata/vars/v1
|
||||
/tmp
|
||||
node_modules
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
build:
|
||||
binary: task
|
||||
main: cmd/task/task.go
|
||||
main: ./cmd/task
|
||||
goos:
|
||||
- windows
|
||||
- darwin
|
||||
@@ -8,26 +8,79 @@ build:
|
||||
goarch:
|
||||
- 386
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
goarm:
|
||||
- 6
|
||||
ignore:
|
||||
- goos: darwin
|
||||
goarch: 386
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w # Don't set main.version.
|
||||
|
||||
archive:
|
||||
name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
|
||||
gomod:
|
||||
proxy: true
|
||||
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
archives:
|
||||
- name_template: "{{.Binary}}_{{.Os}}_{{.Arch}}"
|
||||
files:
|
||||
- README.md
|
||||
- LICENSE
|
||||
- completion/**/*
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
release:
|
||||
draft: true
|
||||
|
||||
fpm:
|
||||
vendor: Task
|
||||
homepage: https://github.com/go-task/task
|
||||
maintainer: Andrey Nering <andrey.nering@gmail.com>
|
||||
description: Simple task runner written in Go
|
||||
license: MIT
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
snapshot:
|
||||
name_template: "{{.Tag}}"
|
||||
|
||||
checksum:
|
||||
name_template: "task_checksums.txt"
|
||||
|
||||
nfpms:
|
||||
- vendor: Task
|
||||
homepage: https://taskfile.dev
|
||||
maintainer: Andrey Nering <andrey@nering.com.br>
|
||||
description: Simple task runner written in Go
|
||||
license: MIT
|
||||
conflicts:
|
||||
- taskwarrior
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
file_name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}"
|
||||
contents:
|
||||
- src: completion/bash/task.bash
|
||||
dst: /etc/bash_completion.d/task
|
||||
- src: completion/fish/task.fish
|
||||
dst: /usr/share/fish/completions/task.fish
|
||||
- src: completion/zsh/_task
|
||||
dst: /usr/local/share/zsh/site-functions/_task
|
||||
|
||||
brews:
|
||||
- name: go-task
|
||||
description: Task runner / simpler Make alternative written in Go
|
||||
license: MIT
|
||||
homepage: https://taskfile.dev
|
||||
folder: Formula
|
||||
tap:
|
||||
owner: go-task
|
||||
name: homebrew-tap
|
||||
test:
|
||||
system "#{bin}/task", "--help"
|
||||
install: |-
|
||||
bin.install "task"
|
||||
bash_completion.install "completion/bash/task.bash" => "task"
|
||||
zsh_completion.install "completion/zsh/_task" => "_task"
|
||||
fish_completion.install "completion/fish/task.fish"
|
||||
commit_author:
|
||||
name: task-bot
|
||||
email: 106601941+task-bot@users.noreply.github.com
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.8
|
||||
- 1.9
|
||||
script:
|
||||
- go install github.com/go-task/task/cmd/task
|
||||
- task dl-deps
|
||||
- task lint
|
||||
- task test
|
||||
600
CHANGELOG.md
Normal file
600
CHANGELOG.md
Normal file
@@ -0,0 +1,600 @@
|
||||
# Changelog
|
||||
|
||||
## v3.18.0
|
||||
|
||||
- Show aliases on `task --list --silent` (`task --ls`). This means that aliases
|
||||
will be completed by the completion scripts
|
||||
([#919](https://github.com/go-task/task/pull/919)).
|
||||
- Tasks in the root Taskfile will now be displayed first in `--list`/`--list-all`
|
||||
output ([#806](https://github.com/go-task/task/pull/806), [#890](https://github.com/go-task/task/pull/890)).
|
||||
- It's now possible to call a `default` task in an included Taskfile by using
|
||||
just the namespace. For example: `docs:default` is now automatically
|
||||
aliased to `docs`
|
||||
([#661](https://github.com/go-task/task/issues/661), [#815](https://github.com/go-task/task/pull/815)).
|
||||
|
||||
## v3.17.0
|
||||
|
||||
- Add a "Did you mean ...?" suggestion when a task does not exits another one
|
||||
with a similar name is found
|
||||
([#867](https://github.com/go-task/task/issues/867), [#880](https://github.com/go-task/task/pull/880)).
|
||||
- Now YAML parse errors will print which Taskfile failed to parse
|
||||
([#885](https://github.com/go-task/task/issues/885), [#887](https://github.com/go-task/task/pull/887)).
|
||||
- Add ability to set `aliases` for tasks and namespaces ([#268](https://github.com/go-task/task/pull/268), [#340](https://github.com/go-task/task/pull/340), [#879](https://github.com/go-task/task/pull/879)).
|
||||
- Improvements to Fish shell completion
|
||||
([#897](https://github.com/go-task/task/pull/897)).
|
||||
- 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`
|
||||
([#603](https://github.com/go-task/task/issues/603), [#877](https://github.com/go-task/task/pull/877)).
|
||||
|
||||
## v3.16.0 - 2022-09-29
|
||||
|
||||
- Add `npm` as new installation method: `npm i -g @go-task/cli`
|
||||
([#870](https://github.com/go-task/task/issues/870), [#871](https://github.com/go-task/task/pull/871), [npm package](https://www.npmjs.com/package/@go-task/cli)).
|
||||
- Add support to marking tasks and includes as internal, which will hide them
|
||||
from `--list` and `--list-all`
|
||||
([#818](https://github.com/go-task/task/pull/818)).
|
||||
|
||||
## v3.15.2 - 2022-09-08
|
||||
|
||||
- Fix error when using variable in `env:` introduced in the previous release
|
||||
([#858](https://github.com/go-task/task/issues/858), [#866](https://github.com/go-task/task/pull/866)).
|
||||
- Fix handling of `CLI_ARGS` (`--`) in Bash completion
|
||||
([#863](https://github.com/go-task/task/pull/863)).
|
||||
- On zsh completion, add ability to replace `--list-all` with `--list` as
|
||||
already possible on the Bash completion
|
||||
([#861](https://github.com/go-task/task/pull/861)).
|
||||
|
||||
## v3.15.0 - 2022-09-03
|
||||
|
||||
- Add new special variables `ROOT_DIR` and `TASKFILE_DIR`. This was a highly
|
||||
requested feature
|
||||
([#215](https://github.com/go-task/task/issues/215), [#857](https://github.com/go-task/task/pull/857), [Documentation](https://taskfile.dev/api/#special-variables)).
|
||||
- Follow symlinks on `sources`
|
||||
([#826](https://github.com/go-task/task/issues/826), [#831](https://github.com/go-task/task/pull/831)).
|
||||
- Improvements and fixes to Bash completion
|
||||
([#835](https://github.com/go-task/task/pull/835), [#844](https://github.com/go-task/task/pull/844)).
|
||||
|
||||
## v3.14.1 - 2022-08-03
|
||||
|
||||
- Always resolve relative include paths relative to the including Taskfile
|
||||
([#822](https://github.com/go-task/task/issues/822), [#823](https://github.com/go-task/task/pull/823)).
|
||||
- Fix ZSH and PowerShell completions to consider all tasks instead of just the
|
||||
public ones (those with descriptions)
|
||||
([#803](https://github.com/go-task/task/pull/803)).
|
||||
|
||||
## v3.14.0 - 2022-07-08
|
||||
|
||||
- Add ability to override the `.task` directory location with the
|
||||
`TASK_TEMP_DIR` environment variable.
|
||||
- Allow to override Task colors using environment variables:
|
||||
`TASK_COLOR_RESET`, `TASK_COLOR_BLUE`, `TASK_COLOR_GREEN`,
|
||||
`TASK_COLOR_CYAN`, `TASK_COLOR_YELLOW`, `TASK_COLOR_MAGENTA`
|
||||
and `TASK_COLOR_RED`
|
||||
([#568](https://github.com/go-task/task/pull/568), [#792](https://github.com/go-task/task/pull/792)).
|
||||
- Fixed bug when using the `output: group` mode where STDOUT and STDERR were
|
||||
being print in separated blocks instead of in the right order
|
||||
([#779](https://github.com/go-task/task/issues/779)).
|
||||
- Starting on this release, ARM architecture binaries are been released to Snap
|
||||
as well
|
||||
([#795](https://github.com/go-task/task/issues/795)).
|
||||
- i386 binaries won't be available anymore on Snap because Ubuntu removed the support
|
||||
for this architecture.
|
||||
- Upgrade mvdan.cc/sh, which fixes a bug with associative arrays
|
||||
([#785](https://github.com/go-task/task/issues/785), [mvdan/sh#884](https://github.com/mvdan/sh/issues/884), [mvdan/sh#893](https://github.com/mvdan/sh/pull/893)).
|
||||
|
||||
## v3.13.0 - 2022-06-13
|
||||
|
||||
- Added `-n` as an alias to `--dry`
|
||||
([#776](https://github.com/go-task/task/issues/776), [#777](https://github.com/go-task/task/pull/777)).
|
||||
- Fix behavior of interrupt (SIGINT, SIGTERM) signals. Task will now give time
|
||||
for the processes running to do cleanup work
|
||||
([#458](https://github.com/go-task/task/issues/458), [#479](https://github.com/go-task/task/pull/479), [#728](https://github.com/go-task/task/issues/728), [#769](https://github.com/go-task/task/pull/769)).
|
||||
- Add new `--exit-code` (`-x`) flag that will pass-through the exit form the
|
||||
command being ran
|
||||
([#755](https://github.com/go-task/task/pull/755)).
|
||||
|
||||
## v3.12.1 - 2022-05-10
|
||||
|
||||
- Fixed bug where, on Windows, variables were ending with `\r` because we were
|
||||
only removing the final `\n` but not `\r\n`
|
||||
([#717](https://github.com/go-task/task/issues/717)).
|
||||
|
||||
## v3.12.0 - 2022-03-31
|
||||
|
||||
- The `--list` and `--list-all` flags can now be combined with the `--silent`
|
||||
flag to print the task names only, without their description
|
||||
([#691](https://github.com/go-task/task/pull/691)).
|
||||
- Added support for multi-level inclusion of Taskfiles. This means that
|
||||
included Taskfiles can also include other Taskfiles. Before this was limited
|
||||
to one level
|
||||
([#390](https://github.com/go-task/task/issues/390), [#623](https://github.com/go-task/task/discussions/623), [#656](https://github.com/go-task/task/pull/656)).
|
||||
- Add ability to specify vars when including a Taskfile.
|
||||
[Check out the documentation](https://taskfile.dev/#/usage?id=vars-of-included-taskfiles)
|
||||
for more information.
|
||||
([#677](https://github.com/go-task/task/pull/677)).
|
||||
|
||||
## v3.11.0 - 2022-02-19
|
||||
|
||||
- Task now supports printing begin and end messages when using the `group`
|
||||
output mode, useful for grouping tasks in CI systems.
|
||||
[Check out the documentation](http://taskfile.dev/#/usage?id=output-syntax) for more information
|
||||
([#647](https://github.com/go-task/task/issues/647), [#651](https://github.com/go-task/task/pull/651)).
|
||||
- Add `Taskfile.dist.yml` and `Taskfile.dist.yaml` to the supported file
|
||||
name list. [Check out the documentation](https://taskfile.dev/#/usage?id=supported-file-names) for more information
|
||||
([#498](https://github.com/go-task/task/issues/498), [#666](https://github.com/go-task/task/pull/666)).
|
||||
|
||||
## v3.10.0 - 2022-01-04
|
||||
|
||||
- A new `--list-all` (alias `-a`) flag is now available. It's similar to the
|
||||
exiting `--list` (`-l`) but prints all tasks, even those without a
|
||||
description
|
||||
([#383](https://github.com/go-task/task/issues/383), [#401](https://github.com/go-task/task/pull/401)).
|
||||
- It's now possible to schedule cleanup commands to run once a task finishes
|
||||
with the `defer:` keyword
|
||||
([Documentation](https://taskfile.dev/#/usage?id=doing-task-cleanup-with-defer), [#475](https://github.com/go-task/task/issues/475), [#626](https://github.com/go-task/task/pull/626)).
|
||||
- Remove long deprecated and undocumented `$` variable prefix and `^` command
|
||||
prefix
|
||||
([#642](https://github.com/go-task/task/issues/642), [#644](https://github.com/go-task/task/issues/644), [#645](https://github.com/go-task/task/pull/645)).
|
||||
- Add support for `.yaml` extension (as an alternative to `.yml`).
|
||||
This was requested multiple times throughout the years. Enjoy!
|
||||
([#183](https://github.com/go-task/task/issues/183), [#184](https://github.com/go-task/task/pull/184), [#369](https://github.com/go-task/task/issues/369), [#584](https://github.com/go-task/task/issues/584), [#621](https://github.com/go-task/task/pull/621)).
|
||||
- Fixed error when computing a variable when the task directory do not exist
|
||||
yet
|
||||
([#481](https://github.com/go-task/task/issues/481), [#579](https://github.com/go-task/task/pull/579)).
|
||||
|
||||
## v3.9.2 - 2021-12-02
|
||||
|
||||
- Upgrade [mvdan/sh](https://github.com/mvdan/sh) which contains a fix a for
|
||||
a important regression on Windows
|
||||
([#619](https://github.com/go-task/task/issues/619), [mvdan/sh#768](https://github.com/mvdan/sh/issues/768), [mvdan/sh#769](https://github.com/mvdan/sh/pull/769)).
|
||||
|
||||
## v3.9.1 - 2021-11-28
|
||||
|
||||
- Add logging in verbose mode for when a task starts and finishes
|
||||
([#533](https://github.com/go-task/task/issues/533), [#588](https://github.com/go-task/task/pull/588)).
|
||||
- Fix an issue with preconditions and context errors
|
||||
([#597](https://github.com/go-task/task/issues/597), [#598](https://github.com/go-task/task/pull/598)).
|
||||
- Quote each `{{.CLI_ARGS}}` argument to prevent one with spaces to become many
|
||||
([#613](https://github.com/go-task/task/pull/613)).
|
||||
- Fix nil pointer when `cmd:` was left empty
|
||||
([#612](https://github.com/go-task/task/issues/612), [#614](https://github.com/go-task/task/pull/614)).
|
||||
- Upgrade [mvdan/sh](https://github.com/mvdan/sh) which contains two
|
||||
relevant fixes:
|
||||
- Fix quote of empty strings in `shellQuote`
|
||||
([#609](https://github.com/go-task/task/issues/609), [mvdan/sh#763](https://github.com/mvdan/sh/issues/763)).
|
||||
- Fix issue of wrong environment variable being picked when there's another
|
||||
very similar one
|
||||
([#586](https://github.com/go-task/task/issues/586), [mvdan/sh#745](https://github.com/mvdan/sh/pull/745)).
|
||||
- Install shell completions automatically when installing via Homebrew
|
||||
([#264](https://github.com/go-task/task/issues/264), [#592](https://github.com/go-task/task/pull/592), [go-task/homebrew-tap#2](https://github.com/go-task/homebrew-tap/pull/2)).
|
||||
|
||||
## v3.9.0 - 2021-10-02
|
||||
|
||||
- A new `shellQuote` function was added to the template system
|
||||
(`{{shellQuote "a string"}}`) to ensure a string is safe for use in shell
|
||||
([mvdan/sh#727](https://github.com/mvdan/sh/pull/727), [mvdan/sh#737](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote))
|
||||
- In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded
|
||||
with some small fixes and features
|
||||
- The `read -p` flag is now supported
|
||||
([#314](https://github.com/go-task/task/issues/314), [mvdan/sh#551](https://github.com/mvdan/sh/issues/551), [mvdan/sh#772](https://github.com/mvdan/sh/pull/722))
|
||||
- The `pwd -P` and `pwd -L` flags are now supported
|
||||
([#553](https://github.com/go-task/task/issues/553), [mvdan/sh#724](https://github.com/mvdan/sh/issues/724), [mvdan/sh#728](https://github.com/mvdan/sh/pull/728))
|
||||
- The `$GID` environment variable is now correctly being set
|
||||
([#561](https://github.com/go-task/task/issues/561), [mvdan/sh#723](https://github.com/mvdan/sh/pull/723))
|
||||
|
||||
## v3.8.0 - 2021-09-26
|
||||
|
||||
- Add `interactive: true` setting to improve support for interactive CLI apps
|
||||
([#217](https://github.com/go-task/task/issues/217), [#563](https://github.com/go-task/task/pull/563)).
|
||||
- Fix some `nil` errors
|
||||
([#534](https://github.com/go-task/task/issues/534), [#573](https://github.com/go-task/task/pull/573)).
|
||||
- Add ability to declare an included Taskfile as optional
|
||||
([#519](https://github.com/go-task/task/issues/519), [#552](https://github.com/go-task/task/pull/552)).
|
||||
- Add support for including Taskfiles in the home directory by using `~`
|
||||
([#539](https://github.com/go-task/task/issues/539), [#557](https://github.com/go-task/task/pull/557)).
|
||||
|
||||
## v3.7.3 - 2021-09-04
|
||||
|
||||
- Add official support to Apple M1 ([#564](https://github.com/go-task/task/pull/564), [#567](https://github.com/go-task/task/pull/567)).
|
||||
- Our [official Homebrew tap](https://github.com/go-task/homebrew-tap) will
|
||||
support more platforms, including Apple M1
|
||||
|
||||
## v3.7.0 - 2021-07-31
|
||||
|
||||
- Add `run:` setting to control if tasks should run multiple times or not.
|
||||
Available options are `always` (the default), `when_changed` (if a variable
|
||||
modified the task) and `once` (run only once no matter what).
|
||||
This is a long time requested feature. Enjoy!
|
||||
([#53](https://github.com/go-task/task/issues/53), [#359](https://github.com/go-task/task/pull/359)).
|
||||
|
||||
## v3.6.0 - 2021-07-10
|
||||
|
||||
- Allow using both `sources:` and `status:` in the same task
|
||||
([#411](https://github.com/go-task/task/issues/411), [#427](https://github.com/go-task/task/issues/427), [#477](https://github.com/go-task/task/pull/477)).
|
||||
- Small optimization and bug fix: don't compute variables if not needed for
|
||||
`dotenv:` ([#517](https://github.com/go-task/task/issues/517)).
|
||||
|
||||
## v3.5.0 - 2021-07-04
|
||||
|
||||
- Add support for interpolation in `dotenv:`
|
||||
([#433](https://github.com/go-task/task/discussions/433), [#434](https://github.com/go-task/task/issues/434), [#453](https://github.com/go-task/task/pull/453)).
|
||||
|
||||
## 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
|
||||
|
||||
- Add support for delegating CLI arguments to commands with `--` and a
|
||||
special `CLI_ARGS` variable
|
||||
([#327](https://github.com/go-task/task/issues/327)).
|
||||
- Add a `--concurrency` (alias `-C`) flag, to limit the number of tasks that
|
||||
run concurrently. This is useful for heavy workloads.
|
||||
([#345](https://github.com/go-task/task/pull/345)).
|
||||
|
||||
## v3.2.2 - 2021-01-12
|
||||
|
||||
- Improve performance of `--list` and `--summary` by skipping running shell
|
||||
variables for these flags
|
||||
([#332](https://github.com/go-task/task/issues/332)).
|
||||
- Fixed a bug where an environment in a Taskfile was not always overridable
|
||||
by the system environment
|
||||
([#425](https://github.com/go-task/task/issues/425)).
|
||||
- Fixed environment from .env files not being available as variables
|
||||
([#379](https://github.com/go-task/task/issues/379)).
|
||||
- The install script is now working for ARM platforms
|
||||
([#428](https://github.com/go-task/task/pull/428)).
|
||||
|
||||
## v3.2.1 - 2021-01-09
|
||||
|
||||
- Fixed some bugs and regressions regarding dynamic variables and directories
|
||||
([#426](https://github.com/go-task/task/issues/426)).
|
||||
- The [slim-sprig](https://github.com/go-task/slim-sprig) package was updated
|
||||
with the upstream [sprig](https://github.com/Masterminds/sprig).
|
||||
|
||||
## v3.2.0 - 2021-01-07
|
||||
|
||||
- Fix the `.task` directory being created in the task directory instead of the
|
||||
Taskfile directory
|
||||
([#247](https://github.com/go-task/task/issues/247)).
|
||||
- Fix a bug where dynamic variables (those declared with `sh:`) were not
|
||||
running in the task directory when the task has a custom dir or it was
|
||||
in an included Taskfile
|
||||
([#384](https://github.com/go-task/task/issues/384)).
|
||||
- The watch feature (via the `--watch` flag) got a few different bug fixes and
|
||||
should be more stable now
|
||||
([#423](https://github.com/go-task/task/pull/423), [#365](https://github.com/go-task/task/issues/365)).
|
||||
|
||||
## v3.1.0 - 2021-01-03
|
||||
|
||||
- Fix a bug when the checksum up-to-date resolution is used by a task
|
||||
with a custom `label:` attribute
|
||||
([#412](https://github.com/go-task/task/issues/412)).
|
||||
- Starting from this release, we're releasing official ARMv6 and ARM64 binaries
|
||||
for Linux
|
||||
([#375](https://github.com/go-task/task/issues/375), [#418](https://github.com/go-task/task/issues/418)).
|
||||
- Task now respects the order of declaration of included Taskfiles when
|
||||
evaluating variables declaring by them
|
||||
([#393](https://github.com/go-task/task/issues/393)).
|
||||
- `set -e` is now automatically set on every command. This was done to fix an
|
||||
issue where multiline string commands wouldn't really fail unless the
|
||||
sentence was in the last line
|
||||
([#403](https://github.com/go-task/task/issues/403)).
|
||||
|
||||
## v3.0.1 - 2020-12-26
|
||||
|
||||
- Allow use as a library by moving the required packages out of the `internal`
|
||||
directory
|
||||
([#358](https://github.com/go-task/task/pull/358)).
|
||||
- Do not error if a specified dotenv file does not exist
|
||||
([#378](https://github.com/go-task/task/issues/378), [#385](https://github.com/go-task/task/pull/385)).
|
||||
- Fix panic when you have empty tasks in your Taskfile
|
||||
([#338](https://github.com/go-task/task/issues/338), [#362](https://github.com/go-task/task/pull/362)).
|
||||
|
||||
## v3.0.0 - 2020-08-16
|
||||
|
||||
- On `v3`, all CLI variables will be considered global variables
|
||||
([#336](https://github.com/go-task/task/issues/336), [#341](https://github.com/go-task/task/pull/341))
|
||||
- Add support to `.env` like files
|
||||
([#324](https://github.com/go-task/task/issues/324), [#356](https://github.com/go-task/task/pull/356)).
|
||||
- Add `label:` to task so you can override the task name in the logs
|
||||
([#321](https://github.com/go-task/task/issues/321]), [#337](https://github.com/go-task/task/pull/337)).
|
||||
- Refactor how variables work on version 3
|
||||
([#311](https://github.com/go-task/task/pull/311)).
|
||||
- Disallow `expansions` on v3 since it has no effect.
|
||||
- `Taskvars.yml` is not automatically included anymore.
|
||||
- `Taskfile_{{OS}}.yml` is not automatically included anymore.
|
||||
- Allow interpolation on `includes`, so you can manually include a Taskfile
|
||||
based on operation system, for example.
|
||||
- Expose `.TASK` variable in templates with the task name
|
||||
([#252](https://github.com/go-task/task/issues/252)).
|
||||
- Implement short task syntax
|
||||
([#194](https://github.com/go-task/task/issues/194), [#240](https://github.com/go-task/task/pull/240)).
|
||||
- Added option to make included Taskfile run commands on its own directory
|
||||
([#260](https://github.com/go-task/task/issues/260), [#144](https://github.com/go-task/task/issues/144))
|
||||
- Taskfiles in version 1 are not supported anymore
|
||||
([#237](https://github.com/go-task/task/pull/237)).
|
||||
- Added global `method:` option. With this option, you can set a default
|
||||
method to all tasks in a Taskfile
|
||||
([#246](https://github.com/go-task/task/issues/246)).
|
||||
- Changed default method from `timestamp` to `checksum`
|
||||
([#246](https://github.com/go-task/task/issues/246)).
|
||||
- New magic variables are now available when using `status:`:
|
||||
`.TIMESTAMP` which contains the greatest modification date
|
||||
from the files listed in `sources:`, and `.CHECKSUM`, which
|
||||
contains a checksum of all files listed in `status:`.
|
||||
This is useful for manual checking when using external, or even remote,
|
||||
artifacts when using `status:`
|
||||
([#216](https://github.com/go-task/task/pull/216)).
|
||||
- We're now using [slim-sprig](https://github.com/go-task/slim-sprig) instead of
|
||||
[sprig](https://github.com/Masterminds/sprig), which allowed a file size
|
||||
reduction of about 22%
|
||||
([#219](https://github.com/go-task/task/pull/219)).
|
||||
- We now use some colors on Task output to better distinguish message types -
|
||||
commands are green, errors are red, etc
|
||||
([#207](https://github.com/go-task/task/pull/207)).
|
||||
|
||||
## v2.8.1 - 2020-05-20
|
||||
|
||||
- Fix error code for the `--help` flag
|
||||
([#300](https://github.com/go-task/task/issues/300), [#330](https://github.com/go-task/task/pull/330)).
|
||||
- Print version to stdout instead of stderr
|
||||
([#299](https://github.com/go-task/task/issues/299), [#329](https://github.com/go-task/task/pull/329)).
|
||||
- Supress `context` errors when using the `--watch` flag
|
||||
([#313](https://github.com/go-task/task/issues/313), [#317](https://github.com/go-task/task/pull/317)).
|
||||
- Support templating on description
|
||||
([#276](https://github.com/go-task/task/issues/276), [#283](https://github.com/go-task/task/pull/283)).
|
||||
|
||||
## v2.8.0 - 2019-12-07
|
||||
|
||||
- Add `--parallel` flag (alias `-p`) to run tasks given by the command line in
|
||||
parallel
|
||||
([#266](https://github.com/go-task/task/pull/266)).
|
||||
- Fixed bug where calling the `task` CLI only informing global vars would not
|
||||
execute the `default` task.
|
||||
- Add hability to silent all tasks by adding `silent: true` a the root of the
|
||||
Taskfile.
|
||||
|
||||
## v2.7.1 - 2019-11-10
|
||||
|
||||
- Fix error being raised when `exit 0` was called
|
||||
([#251](https://github.com/go-task/task/issues/251)).
|
||||
|
||||
## v2.7.0 - 2019-09-22
|
||||
|
||||
- Fixed panic bug when assigning a global variable
|
||||
([#229](https://github.com/go-task/task/issues/229), [#243](https://github.com/go-task/task/issues/234)).
|
||||
- A task with `method: checksum` will now re-run if generated files are deleted
|
||||
([#228](https://github.com/go-task/task/pull/228), [#238](https://github.com/go-task/task/issues/238)).
|
||||
|
||||
## v2.6.0 - 2019-07-21
|
||||
|
||||
- Fixed some bugs regarding minor version checks on `version:`.
|
||||
- Add `preconditions:` to task
|
||||
([#205](https://github.com/go-task/task/pull/205)).
|
||||
- Create directory informed on `dir:` if it doesn't exist
|
||||
([#209](https://github.com/go-task/task/issues/209), [#211](https://github.com/go-task/task/pull/211)).
|
||||
- We now have a `--taskfile` flag (alias `-t`), which can be used to run
|
||||
another Taskfile (other than the default `Taskfile.yml`)
|
||||
([#221](https://github.com/go-task/task/pull/221)).
|
||||
- It's now possible to install Task using Homebrew on Linux
|
||||
([go-task/homebrew-tap#1](https://github.com/go-task/homebrew-tap/pull/1)).
|
||||
|
||||
## v2.5.2 - 2019-05-11
|
||||
|
||||
- Reverted YAML upgrade due issues with CRLF on Windows
|
||||
([#201](https://github.com/go-task/task/issues/201), [go-yaml/yaml#450](https://github.com/go-yaml/yaml/issues/450)).
|
||||
- Allow setting global variables through the CLI
|
||||
([#192](https://github.com/go-task/task/issues/192)).
|
||||
|
||||
## 2.5.1 - 2019-04-27
|
||||
|
||||
- Fixed some issues with interactive command line tools, where sometimes
|
||||
the output were not being shown, and similar issues
|
||||
([#114](https://github.com/go-task/task/issues/114), [#190](https://github.com/go-task/task/issues/190), [#200](https://github.com/go-task/task/pull/200)).
|
||||
- Upgraded [go-yaml/yaml](https://github.com/go-yaml/yaml) from v2 to v3.
|
||||
|
||||
## v2.5.0 - 2019-03-16
|
||||
|
||||
- We moved from the taskfile.org domain to the new fancy taskfile.dev domain.
|
||||
While stuff is being redirected, we strongly recommend to everyone that use
|
||||
[this install script](https://taskfile.dev/#/installation?id=install-script)
|
||||
to use the new taskfile.dev domain on scripts from now on.
|
||||
- Fixed to the ZSH completion
|
||||
([#182](https://github.com/go-task/task/pull/182)).
|
||||
- Add [`--summary` flag along with `summary:` task attribute](https://taskfile.org/#/usage?id=display-summary-of-task)
|
||||
([#180](https://github.com/go-task/task/pull/180)).
|
||||
|
||||
## v2.4.0 - 2019-02-21
|
||||
|
||||
- Allow calling a task of the root Taskfile from an included Taskfile
|
||||
by prefixing it with `:`
|
||||
([#161](https://github.com/go-task/task/issues/161), [#172](https://github.com/go-task/task/issues/172)),
|
||||
- Add flag to override the `output` option
|
||||
([#173](https://github.com/go-task/task/pull/173));
|
||||
- Fix bug where Task was persisting the new checksum on the disk when the Dry
|
||||
Mode is enabled
|
||||
([#166](https://github.com/go-task/task/issues/166));
|
||||
- Fix file timestamp issue when the file name has spaces
|
||||
([#176](https://github.com/go-task/task/issues/176));
|
||||
- Mitigating path expanding issues on Windows
|
||||
([#170](https://github.com/go-task/task/pull/170)).
|
||||
|
||||
## v2.3.0 - 2019-01-02
|
||||
|
||||
- On Windows, Task can now be installed using [Scoop](https://scoop.sh/)
|
||||
([#152](https://github.com/go-task/task/pull/152));
|
||||
- Fixed issue with file/directory globing
|
||||
([#153](https://github.com/go-task/task/issues/153));
|
||||
- Added ability to globally set environment variables
|
||||
(
|
||||
[#138](https://github.com/go-task/task/pull/138),
|
||||
[#159](https://github.com/go-task/task/pull/159)
|
||||
).
|
||||
|
||||
## v2.2.1 - 2018-12-09
|
||||
|
||||
- This repository now uses Go Modules (#143). We'll still keep the `vendor` directory in sync for some time, though;
|
||||
- Fixing a bug when the Taskfile has no tasks but includes another Taskfile (#150);
|
||||
- Fix a bug when calling another task or a dependency in an included Taskfile (#151).
|
||||
|
||||
## v2.2.0 - 2018-10-25
|
||||
|
||||
- Added support for [including other Taskfiles](https://taskfile.org/#/usage?id=including-other-taskfiles) (#98)
|
||||
- This should be considered experimental. For now, only including local files is supported, but support for including remote Taskfiles is being discussed. If you have any feedback, please comment on #98.
|
||||
- Task now have a dedicated documentation site: https://taskfile.org
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/master/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
|
||||
## v2.1.1 - 2018-09-17
|
||||
|
||||
- Fix suggestion to use `task --init` not being shown anymore (when a `Taskfile.yml` is not found)
|
||||
- Fix error when using checksum method and no file exists for a source glob (#131)
|
||||
- Fix signal handling when the `--watch` flag is given (#132)
|
||||
|
||||
## v2.1.0 - 2018-08-19
|
||||
|
||||
- Add a `ignore_error` option to task and command (#123)
|
||||
- Add a dry run mode (`--dry` flag) (#126)
|
||||
|
||||
## v2.0.3 - 2018-06-24
|
||||
|
||||
- Expand environment variables on "dir", "sources" and "generates" (#116)
|
||||
- Fix YAML merging syntax (#112)
|
||||
- Add ZSH completion (#111)
|
||||
- Implement new `output` option. Please check out the [documentation](https://github.com/go-task/task#output-syntax)
|
||||
|
||||
## v2.0.2 - 2018-05-01
|
||||
|
||||
- Fix merging of YAML anchors (#112)
|
||||
|
||||
## v2.0.1 - 2018-03-11
|
||||
|
||||
- Fixes panic on `task --list`
|
||||
|
||||
## v2.0.0 - 2018-03-08
|
||||
|
||||
Version 2.0.0 is here, with a new Taskfile format.
|
||||
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/master/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
|
||||
* New Taskfile version 2 (https://github.com/go-task/task/issues/77)
|
||||
* Possibility to have global variables in the `Taskfile.yml` instead of `Taskvars.yml` (https://github.com/go-task/task/issues/66)
|
||||
* Small improvements and fixes
|
||||
|
||||
## v1.4.4 - 2017-11-19
|
||||
|
||||
- Handle SIGINT and SIGTERM (#75);
|
||||
- List: print message with there's no task with description;
|
||||
- Expand home dir ("~" symbol) on paths (#74);
|
||||
- Add Snap as an installation method;
|
||||
- Move examples to its own repo;
|
||||
- Watch: also walk on tasks called on on "cmds", and not only on "deps";
|
||||
- Print logs to stderr instead of stdout (#68);
|
||||
- Remove deprecated `set` keyword;
|
||||
- Add checksum based status check, alternative to timestamp based.
|
||||
|
||||
## v1.4.3 - 2017-09-07
|
||||
|
||||
- Allow assigning variables to tasks at run time via CLI (#33)
|
||||
- Added suport for multiline variables from sh (#64)
|
||||
- Fixes env: remove square braces and evaluate shell (#62)
|
||||
- Watch: change watch library and few fixes and improvements
|
||||
- When use watching, cancel and restart long running process on file change (#59 and #60)
|
||||
|
||||
## v1.4.2 - 2017-07-30
|
||||
|
||||
- Flag to set directory of execution
|
||||
- Always echo command if is verbose mode
|
||||
- Add silent mode to disable echoing of commands
|
||||
- Fixes and improvements of variables (#56)
|
||||
|
||||
## v1.4.1 - 2017-07-15
|
||||
|
||||
- Allow use of YAML for dynamic variables instead of $ prefix
|
||||
- `VAR: {sh: echo Hello}` instead of `VAR: $echo Hello`
|
||||
- Add `--list` (or `-l`) flag to print existing tasks
|
||||
- OS specific Taskvars file (e.g. `Taskvars_windows.yml`, `Taskvars_linux.yml`, etc)
|
||||
- Consider task up-to-date on equal timestamps (#49)
|
||||
- Allow absolute path in generates section (#48)
|
||||
- Bugfix: allow templating when calling deps (#42)
|
||||
- Fix panic for invalid task in cyclic dep detection
|
||||
- Better error output for dynamic variables in Taskvars.yml (#41)
|
||||
- Allow template evaluation in parameters
|
||||
|
||||
## v1.4.0 - 2017-07-06
|
||||
|
||||
- Cache dynamic variables
|
||||
- Add verbose mode (`-v` flag)
|
||||
- Support to task parameters (overriding vars) (#31) (#32)
|
||||
- Print command, also when "set:" is specified (#35)
|
||||
- Improve task command help text (#35)
|
||||
|
||||
## v1.3.1 - 2017-06-14
|
||||
|
||||
- Fix glob not working on commands (#28)
|
||||
- Add ExeExt template function
|
||||
- Add `--init` flag to create a new Taskfile
|
||||
- Add status option to prevent task from running (#27)
|
||||
- Allow interpolation on `generates` and `sources` attributes (#26)
|
||||
|
||||
## v1.3.0 - 2017-04-24
|
||||
|
||||
- Migrate from os/exec.Cmd to a native Go sh/bash interpreter
|
||||
- This is a potentially breaking change if you use Windows.
|
||||
- Now, `cmd` is not used anymore on Windows. Always use Bash-like syntax for your commands, even on Windows.
|
||||
- Add "ToSlash" and "FromSlash" to template functions
|
||||
- Use functions defined on github.com/Masterminds/sprig
|
||||
- Do not redirect stdin while running variables commands
|
||||
- Using `context` and `errgroup` packages (this will make other tasks to be cancelled, if one returned an error)
|
||||
|
||||
## v1.2.0 - 2017-04-02
|
||||
|
||||
- More tests and Travis integration
|
||||
- Watch a task (experimental)
|
||||
- Possibility to call another task
|
||||
- Fix "=" not being reconized in variables/environment variables
|
||||
- Tasks can now have a description, and help will print them (#10)
|
||||
- Task dependencies now run concurrently
|
||||
- Support for a default task (#16)
|
||||
|
||||
## v1.1.0 - 2017-03-08
|
||||
|
||||
- Support for YAML, TOML and JSON (#1)
|
||||
- Support running command in another directory (#4)
|
||||
- `--force` or `-f` flag to force execution of task even when it's up-to-date
|
||||
- Detection of cyclic dependencies (#5)
|
||||
- Support for variables (#6, #9, #14)
|
||||
- Operation System specific commands and variables (#13)
|
||||
|
||||
## v1.0.0 - 2017-02-28
|
||||
|
||||
- Add LICENSE file
|
||||
@@ -1,11 +0,0 @@
|
||||
* Bug reports and feature requests are welcome in [the issues][issues]
|
||||
* For questions and discussion there's the [Slack room][slack]
|
||||
* Pull Requests are welcome. For more complex changes and features it's
|
||||
recommended to open an issue first
|
||||
* About 3 or 4 pull requests accepted one gets write access to the repo.
|
||||
Even then, possible backward incompatible changes should be discussed first
|
||||
in an issue or pull request
|
||||
* Documentation contributions are as important as code contributions
|
||||
|
||||
[issues]: https://github.com/go-task/task/issues
|
||||
[slack]: https://gophers.slack.com/messages/task
|
||||
111
Gopkg.lock
generated
111
Gopkg.lock
generated
@@ -1,111 +0,0 @@
|
||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/Masterminds/semver"
|
||||
packages = ["."]
|
||||
revision = "517734cc7d6470c0d07130e40fd40bdeb9bcd3fd"
|
||||
version = "v1.3.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/Masterminds/sprig"
|
||||
packages = ["."]
|
||||
revision = "175e437013029f9a1c35bdf04bc451b0d20d4331"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/aokoli/goutils"
|
||||
packages = ["."]
|
||||
revision = "3391d3790d23d03408670993e957e8f408993c34"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/huandu/xstrings"
|
||||
packages = ["."]
|
||||
revision = "3959339b333561bf62a38b424fd41517c2c90f40"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/imdario/mergo"
|
||||
packages = ["."]
|
||||
revision = "e3000cb3d28c72b837601cac94debd91032d19fe"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/mattn/go-zglob"
|
||||
packages = [".","fastwalk"]
|
||||
revision = "95345c4e1c0ebc9d16a3284177f09360f4d20fab"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
packages = ["difflib"]
|
||||
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/radovskyb/watcher"
|
||||
packages = ["."]
|
||||
revision = "6145e1439b9de93806925353403f91d2abbad8a5"
|
||||
version = "v1.0.2"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/satori/go.uuid"
|
||||
packages = ["."]
|
||||
revision = "879c5887cd475cd7864858769793b2ceb0d44feb"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/pflag"
|
||||
packages = ["."]
|
||||
revision = "7aff26db30c1be810f9de5038ec5ef96ac41fd7c"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
|
||||
version = "v1.1.4"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["pbkdf2","scrypt"]
|
||||
revision = "81e90905daefcd6fd217b62423c0908922eadb30"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/net"
|
||||
packages = ["context"]
|
||||
revision = "66aacef3dd8a676686c7ae3716979581e8b03c47"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["errgroup"]
|
||||
revision = "f52d1811a62927559de87708c8913c1650ce4f26"
|
||||
|
||||
[[projects]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
packages = ["."]
|
||||
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "mvdan.cc/sh"
|
||||
packages = ["interp","syntax"]
|
||||
revision = "d8d2c36c06455d4bb8e2116cc2b955271046329d"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "10e83efacd30cadfc07b31678375bdf2e6be288a8b9d175768b1f2efc914f5e1"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
99
Gopkg.toml
99
Gopkg.toml
@@ -1,99 +0,0 @@
|
||||
|
||||
## Gopkg.toml example (these lines may be deleted)
|
||||
|
||||
## "metadata" defines metadata about the project that could be used by other independent
|
||||
## systems. The metadata defined here will be ignored by dep.
|
||||
# [metadata]
|
||||
# key1 = "value that convey data to other systems"
|
||||
# system1-data = "value that is used by a system"
|
||||
# system2-data = "value that is used by another system"
|
||||
|
||||
## "required" lists a set of packages (not projects) that must be included in
|
||||
## Gopkg.lock. This list is merged with the set of packages imported by the current
|
||||
## project. Use it when your project needs a package it doesn't explicitly import -
|
||||
## including "main" packages.
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
|
||||
## "ignored" lists a set of packages (not projects) that are ignored when
|
||||
## dep statically analyzes source code. Ignored packages can be in this project,
|
||||
## or in a dependency.
|
||||
# ignored = ["github.com/user/project/badpkg"]
|
||||
|
||||
## Constraints are rules for how directly imported projects
|
||||
## may be incorporated into the depgraph. They are respected by
|
||||
## dep whether coming from the Gopkg.toml of the current project or a dependency.
|
||||
# [[constraint]]
|
||||
## Required: the root import path of the project being constrained.
|
||||
# name = "github.com/user/project"
|
||||
#
|
||||
## Recommended: the version constraint to enforce for the project.
|
||||
## Only one of "branch", "version" or "revision" can be specified.
|
||||
# version = "1.0.0"
|
||||
# branch = "master"
|
||||
# revision = "abc123"
|
||||
#
|
||||
## Optional: an alternate location (URL or import path) for the project's source.
|
||||
# source = "https://github.com/myfork/package.git"
|
||||
#
|
||||
## "metadata" defines metadata about the dependency or override that could be used
|
||||
## by other independent systems. The metadata defined here will be ignored by dep.
|
||||
# [metadata]
|
||||
# key1 = "value that convey data to other systems"
|
||||
# system1-data = "value that is used by a system"
|
||||
# system2-data = "value that is used by another system"
|
||||
|
||||
## Overrides have the same structure as [[constraint]], but supersede all
|
||||
## [[constraint]] declarations from all projects. Only [[override]] from
|
||||
## the current project's are applied.
|
||||
##
|
||||
## Overrides are a sledgehammer. Use them only as a last resort.
|
||||
# [[override]]
|
||||
## Required: the root import path of the project being constrained.
|
||||
# name = "github.com/user/project"
|
||||
#
|
||||
## Optional: specifying a version constraint override will cause all other
|
||||
## constraints on this project to be ignored; only the overridden constraint
|
||||
## need be satisfied.
|
||||
## Again, only one of "branch", "version" or "revision" can be specified.
|
||||
# version = "1.0.0"
|
||||
# branch = "master"
|
||||
# revision = "abc123"
|
||||
#
|
||||
## Optional: specifying an alternate source location as an override will
|
||||
## enforce that the alternate location is used for that project, regardless of
|
||||
## what source location any dependent projects specify.
|
||||
# source = "https://github.com/myfork/package.git"
|
||||
|
||||
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/Masterminds/sprig"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/imdario/mergo"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/mattn/go-zglob"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "mvdan.cc/sh"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/spf13/pflag"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/sync"
|
||||
|
||||
[[constraint]]
|
||||
branch = "v2"
|
||||
name = "gopkg.in/yaml.v2"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/radovskyb/watcher"
|
||||
543
README.md
543
README.md
@@ -1,534 +1,15 @@
|
||||
[](https://gophers.slack.com/messages/task)
|
||||
[](https://travis-ci.org/go-task/task)
|
||||
<div align="center">
|
||||
<a href="https://taskfile.dev">
|
||||
<img src="docs/static/img/logo.svg" width="200px" height="200px" />
|
||||
</a>
|
||||
|
||||
# Task - A task runner / simpler Make alternative written in Go
|
||||
<h1>Task</h1>
|
||||
|
||||
Task is a simple tool that allows you to easily run development and build
|
||||
tasks. Task is written in Golang, but can be used to develop any language.
|
||||
It aims to be simpler and easier to use then [GNU Make][make].
|
||||
<p>
|
||||
Task is a task runner / build tool that aims to be simpler and easier to use than, for example, <a href="https://www.gnu.org/software/make/">GNU Make<a>.
|
||||
</p>
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Environment](#environment)
|
||||
- [OS specific task](#os-specific-task)
|
||||
- [Task directory](#task-directory)
|
||||
- [Task dependencies](#task-dependencies)
|
||||
- [Calling another task](#calling-another-task)
|
||||
- [Prevent unnecessary work](#prevent-unnecessary-work)
|
||||
- [Variables](#variables)
|
||||
- [Dynamic variables](#dynamic-variables)
|
||||
- [Go's template engine](#gos-template-engine)
|
||||
- [Help](#help)
|
||||
- [Silent mode](#silent-mode)
|
||||
- [Watch tasks](#watch-tasks-experimental)
|
||||
- [Task in the wild](#task-in-the-wild)
|
||||
- [Alternative task runners](#alternative-task-runners)
|
||||
|
||||
## Installation
|
||||
|
||||
If you have a [Golang][golang] environment setup, you can simply run:
|
||||
|
||||
```bash
|
||||
go get -u -v github.com/go-task/task/cmd/task
|
||||
```
|
||||
|
||||
Or you can download the binary from the [releases][releases] page and add to
|
||||
your `PATH`. DEB and RPM packages are also available.
|
||||
The `task_checksums.txt` file contains the SHA-256 checksum for each file.
|
||||
|
||||
## Usage
|
||||
|
||||
Create a file called `Taskfile.yml` in the root of the project.
|
||||
The `cmds` attribute should contains the commands of a task.
|
||||
The example below allows compile a Go app and uses [Minify][minify] to concat
|
||||
and minify multiple CSS files into a single one.
|
||||
|
||||
```yml
|
||||
build:
|
||||
cmds:
|
||||
- go build -v -i main.go
|
||||
|
||||
assets:
|
||||
cmds:
|
||||
- minify -o public/style.css src/css
|
||||
```
|
||||
|
||||
Running the tasks is as simple as running:
|
||||
|
||||
```bash
|
||||
task assets build
|
||||
```
|
||||
|
||||
Task uses [github.com/mvdan/sh](https://github.com/mvdan/sh), a native Go sh
|
||||
interpreter. So you can write sh/bash commands and it will work even on
|
||||
Windows, where `sh` or `bash` is usually not available. Just remember any
|
||||
executable called must be available by the OS or in PATH.
|
||||
|
||||
If you ommit a task name, "default" will be assumed.
|
||||
|
||||
### Environment
|
||||
|
||||
You can specify environment variables that are added when running a command:
|
||||
|
||||
```yml
|
||||
build:
|
||||
cmds:
|
||||
- echo $hallo
|
||||
env:
|
||||
hallo: welt
|
||||
```
|
||||
|
||||
### OS specific task
|
||||
|
||||
If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your taskfile
|
||||
based on the operating system.
|
||||
|
||||
Example:
|
||||
|
||||
Taskfile.yml:
|
||||
|
||||
```yml
|
||||
build:
|
||||
cmds:
|
||||
- echo "default"
|
||||
```
|
||||
|
||||
Taskfile_linux.yml:
|
||||
|
||||
```yml
|
||||
build:
|
||||
cmds:
|
||||
- echo "linux"
|
||||
```
|
||||
|
||||
Will print out `linux` and not default.
|
||||
|
||||
It's also possible to have OS specific `Taskvars.yml` file, like
|
||||
`Taskvars_windows.yml`, `Taskfile_linux.yml` or `Taskvars_darwin.yml`. See the
|
||||
[variables section](#variables) below.
|
||||
|
||||
### Task directory
|
||||
|
||||
By default, tasks will be executed in the directory where the Taskfile is
|
||||
located. But you can easily make the task run in another folder informing
|
||||
`dir`:
|
||||
|
||||
```yml
|
||||
serve:
|
||||
dir: public/www
|
||||
cmds:
|
||||
# run http server
|
||||
- caddy
|
||||
```
|
||||
|
||||
### Task dependencies
|
||||
|
||||
You may have tasks that depends on others. Just pointing them on `deps` will
|
||||
make them run automatically before running the parent task:
|
||||
|
||||
```yml
|
||||
build:
|
||||
deps: [assets]
|
||||
cmds:
|
||||
- go build -v -i main.go
|
||||
|
||||
assets:
|
||||
cmds:
|
||||
- minify -o public/style.css src/css
|
||||
```
|
||||
|
||||
In the above example, `assets` will always run right before `build` if you run
|
||||
`task build`.
|
||||
|
||||
A task can have only dependencies and no commands to group tasks together:
|
||||
|
||||
```yml
|
||||
assets:
|
||||
deps: [js, css]
|
||||
|
||||
js:
|
||||
cmds:
|
||||
- minify -o public/script.js src/js
|
||||
|
||||
css:
|
||||
cmds:
|
||||
- minify -o public/style.css src/css
|
||||
```
|
||||
|
||||
If there are more than one dependency, they always run in parallel for better
|
||||
performance.
|
||||
|
||||
### Calling another task
|
||||
|
||||
When a task has many dependencies, they are executed concurrently. This will
|
||||
often result in a faster build pipeline. But in some situations you may need
|
||||
to call other tasks serially. In this case, just use the following syntax:
|
||||
|
||||
```yml
|
||||
main-task:
|
||||
cmds:
|
||||
- task: task-to-be-called
|
||||
- task: another-task
|
||||
- echo "Both done"
|
||||
|
||||
task-to-be-called:
|
||||
cmds:
|
||||
- echo "Task to be called"
|
||||
|
||||
another-task:
|
||||
cmds:
|
||||
- echo "Another task"
|
||||
```
|
||||
|
||||
Overriding variables in the called task is as simple as informing `vars`
|
||||
attribute:
|
||||
|
||||
```yml
|
||||
main-task:
|
||||
cmds:
|
||||
- task: write-file
|
||||
vars: {FILE: "hello.txt", CONTENT: "Hello!"}
|
||||
- task: write-file
|
||||
vars: {FILE: "world.txt", CONTENT: "World!"}
|
||||
|
||||
write-file:
|
||||
cmds:
|
||||
- echo "{{.CONTENT}}" > {{.FILE}}
|
||||
```
|
||||
|
||||
The above syntax is also supported in `deps`.
|
||||
|
||||
> NOTE: It's also possible to call a task without any param prefixing it
|
||||
with `^`, but this syntax is deprecated:
|
||||
|
||||
```yml
|
||||
a-task:
|
||||
cmds:
|
||||
- ^another-task
|
||||
|
||||
another-task:
|
||||
cmds:
|
||||
- echo "Another task"
|
||||
```
|
||||
|
||||
### Prevent unnecessary work
|
||||
|
||||
If a task generates something, you can inform Task the source and generated
|
||||
files, so Task will prevent to run them if not necessary.
|
||||
|
||||
```yml
|
||||
build:
|
||||
deps: [js, css]
|
||||
cmds:
|
||||
- go build -v -i main.go
|
||||
|
||||
js:
|
||||
cmds:
|
||||
- minify -o public/script.js src/js
|
||||
sources:
|
||||
- src/js/**/*.js
|
||||
generates:
|
||||
- public/script.js
|
||||
|
||||
css:
|
||||
cmds:
|
||||
- minify -o public/style.css src/css
|
||||
sources:
|
||||
- src/css/**/*.css
|
||||
generates:
|
||||
- public/style.css
|
||||
```
|
||||
|
||||
`sources` and `generates` can be files or file patterns. When both are given,
|
||||
Task will compare the modification date/time of the files to determine if it's
|
||||
necessary to run the task. If not, it will just print a message like
|
||||
`Task "js" is up to date`.
|
||||
|
||||
Alternatively, you can inform a sequence of tests as `status`. If no error
|
||||
is returned (exit status 0), the task is considered up-to-date:
|
||||
|
||||
```yml
|
||||
generate-files:
|
||||
cmds:
|
||||
- mkdir directory
|
||||
- touch directory/file1.txt
|
||||
- touch directory/file2.txt
|
||||
# test existence of files
|
||||
status:
|
||||
- test -d directory
|
||||
- test -f directory/file1.txt
|
||||
- test -f directory/file2.txt
|
||||
```
|
||||
|
||||
You can use `--force` or `-f` if you want to force a task to run even when
|
||||
up-to-date.
|
||||
|
||||
### Variables
|
||||
|
||||
When doing interpolation of variables, Task will look for the below.
|
||||
They are listed below in order of importance (e.g. most important first):
|
||||
|
||||
- Variables given while calling a task from another.
|
||||
(See [Calling another task](#calling-another-task) above)
|
||||
- Environment variables
|
||||
- Variables declared locally in the task
|
||||
- Variables available in the `Taskvars.yml` file
|
||||
|
||||
Example of overriding with environment variables:
|
||||
|
||||
```bash
|
||||
$ TASK_VARIABLE=a-value task do-something
|
||||
```
|
||||
|
||||
Since some shells don't support above syntax to set environment variables
|
||||
(Windows) tasks also accepts a similar style when not in the beginning of
|
||||
the command. Variables given in this form are only visible to the task called
|
||||
right before.
|
||||
|
||||
```bash
|
||||
$ task write-file FILE=file.txt "CONTENT=Hello, World!" print "MESSAGE=All done!"
|
||||
```
|
||||
|
||||
Example of locally declared vars:
|
||||
|
||||
```yml
|
||||
print-var:
|
||||
cmds:
|
||||
echo "{{.VAR}}"
|
||||
vars:
|
||||
VAR: Hello!
|
||||
```
|
||||
|
||||
Example of `Taskvars.yml` file:
|
||||
|
||||
```yml
|
||||
PROJECT_NAME: My Project
|
||||
DEV_MODE: production
|
||||
GIT_COMMIT: {sh: git log -n 1 --format=%h}
|
||||
```
|
||||
|
||||
> NOTE: It's also possible setting a variable globally using `set` attribute
|
||||
in task, but this is deprecated:
|
||||
|
||||
```yml
|
||||
build:
|
||||
deps: [set-message]
|
||||
cmds:
|
||||
- echo "Message: {{.MESSAGE}}"
|
||||
|
||||
set-message:
|
||||
cmds:
|
||||
- echo "This is an important message"
|
||||
set: MESSAGE
|
||||
```
|
||||
|
||||
#### Dynamic variables
|
||||
|
||||
The below syntax (`sh:` prop in a variable) is considered a dynamic variable.
|
||||
The value will be treated as a command and the output assigned. If there is one
|
||||
or more trailing newlines, the last newline will be trimmed.
|
||||
|
||||
```yml
|
||||
build:
|
||||
cmds:
|
||||
- go build -ldflags="-X main.Version={{.GIT_COMMIT}}" main.go
|
||||
vars:
|
||||
GIT_COMMIT:
|
||||
sh: git log -n 1 --format=%h
|
||||
```
|
||||
|
||||
This works for all types of variables.
|
||||
|
||||
> It's also possible to prefix the variable with `$` to have a dynamic
|
||||
variable, but this is now considered deprecated:
|
||||
|
||||
```yml
|
||||
# Taskvars.yml
|
||||
|
||||
# recommended
|
||||
GIT_COMMIT:
|
||||
sh: git log -n 1 --format=%h
|
||||
|
||||
# deprecated
|
||||
GIT_COMMIT: $git log -n 1 --format=%h
|
||||
```
|
||||
|
||||
### Go's template engine
|
||||
|
||||
Task parse commands as [Go's template engine][gotemplate] before executing
|
||||
them. Variables are accessible through dot syntax (`.VARNAME`).
|
||||
|
||||
All functions by the Go's [sprig lib](http://masterminds.github.io/sprig/)
|
||||
are available. The following example gets the current date in a given format:
|
||||
|
||||
```yml
|
||||
print-date:
|
||||
cmds:
|
||||
- echo {{now | date "2006-01-02"}}
|
||||
```
|
||||
|
||||
Task also adds the following functions:
|
||||
|
||||
- `OS`: Returns operating system. Possible values are "windows", "linux",
|
||||
"darwin" (macOS) and "freebsd".
|
||||
- `ARCH`: return the architecture Task was compiled to: "386", "amd64", "arm"
|
||||
or "s390x".
|
||||
- `splitLines`: Splits Unix (\n) and Windows (\r\n) styled newlines.
|
||||
- `catLines`: Replaces Unix (\n) and Windows (\r\n) styled newlines with a space.
|
||||
- `toSlash`: Does nothing on Unix, but on Windows converts a string from `\`
|
||||
path format to `/`.
|
||||
- `fromSlash`: Oposite of `toSlash`. Does nothing on Unix, but on Windows
|
||||
converts a string from `\` path format to `/`.
|
||||
- `exeExt`: Returns the right executable extension for the current OS
|
||||
(`".exe"` for Windows, `""` for others).
|
||||
|
||||
Example:
|
||||
|
||||
```yml
|
||||
print-os:
|
||||
cmds:
|
||||
- echo '{{OS}} {{ARCH}}'
|
||||
- echo '{{if eq OS "windows"}}windows-command{{else}}unix-command{{end}}'
|
||||
# This will be path/to/file on Unix but path\to\file on Windows
|
||||
- echo '{{fromSlash "path/to/file"}}'
|
||||
enumerated-file:
|
||||
vars:
|
||||
CONTENT: |
|
||||
foo
|
||||
bar
|
||||
cmds:
|
||||
- |
|
||||
cat << EOF > output.txt
|
||||
{{range $i, $line := .CONTENT | splitLines -}}
|
||||
{{printf "%3d" $i}}: {{$line}}
|
||||
{{end}}EOF
|
||||
```
|
||||
|
||||
> NOTE: There are some deprecated function names still available: `ToSlash`,
|
||||
`FromSlash` and `ExeExt`. These where changed for consistency with sprig lib.
|
||||
|
||||
### Help
|
||||
|
||||
Running `task --list` (or `task -l`) lists all tasks with a description.
|
||||
The following taskfile:
|
||||
|
||||
```yml
|
||||
build:
|
||||
desc: Build the go binary.
|
||||
cmds:
|
||||
- go build -v -i main.go
|
||||
|
||||
test:
|
||||
desc: Run all the go tests.
|
||||
cmds:
|
||||
- go test -race ./...
|
||||
|
||||
js:
|
||||
cmds:
|
||||
- minify -o public/script.js src/js
|
||||
|
||||
css:
|
||||
cmds:
|
||||
- minify -o public/style.css src/css
|
||||
```
|
||||
|
||||
would print the following output:
|
||||
|
||||
```bash
|
||||
* build: Build the go binary.
|
||||
* test: Run all the go tests.
|
||||
```
|
||||
|
||||
## Silent mode
|
||||
|
||||
Silent mode disables echoing of commands before Task runs it.
|
||||
For the following Taskfile:
|
||||
|
||||
```yml
|
||||
echo:
|
||||
cmds:
|
||||
- echo "Print something"
|
||||
```
|
||||
|
||||
Normally this will be print:
|
||||
|
||||
```sh
|
||||
echo "Print something"
|
||||
Print something
|
||||
```
|
||||
|
||||
With silent mode on, the below will be print instead:
|
||||
|
||||
```sh
|
||||
Print something
|
||||
```
|
||||
|
||||
There's three ways to enable silent mode:
|
||||
|
||||
* At command level:
|
||||
|
||||
```yml
|
||||
echo:
|
||||
cmds:
|
||||
- cmd: echo "Print something"
|
||||
silent: true
|
||||
```
|
||||
|
||||
* At task level:
|
||||
|
||||
```yml
|
||||
echo:
|
||||
cmds:
|
||||
- echo "Print something"
|
||||
silent: true
|
||||
```
|
||||
|
||||
* Or globally with `--silent` or `-s` flag
|
||||
|
||||
If you want to suppress stdout instead, just redirect a command to `/dev/null`:
|
||||
|
||||
```yml
|
||||
echo:
|
||||
cmds:
|
||||
- echo "This will print nothing" > /dev/null
|
||||
```
|
||||
|
||||
## Watch tasks (experimental)
|
||||
|
||||
If you give a `--watch` or `-w` argument, task will watch for files changes
|
||||
and run the task again. This requires the `sources` attribute to be given,
|
||||
so task know which files to watch.
|
||||
|
||||
## Task in the wild
|
||||
|
||||
- [How I Build My Static Assets for Hugo][post-hugo]
|
||||
|
||||
## Alternative task runners
|
||||
|
||||
- YAML based:
|
||||
- [tj/robo][robo]
|
||||
- [dogtools/dog][dog]
|
||||
- [goeuro/myke][myke]
|
||||
- [dreadl0ck/zeus][zeus]
|
||||
- Go based:
|
||||
- [go-godo/godo][godo]
|
||||
- [markbates/grift][grift]
|
||||
- [nstratos/make.go][make.go]
|
||||
- Make based:
|
||||
- [tj/mmake][mmake]
|
||||
|
||||
[make]: https://www.gnu.org/software/make/
|
||||
[releases]: https://github.com/go-task/task/releases
|
||||
[golang]: https://golang.org/
|
||||
[gotemplate]: https://golang.org/pkg/text/template/
|
||||
[robo]: https://github.com/tj/robo
|
||||
[dog]: https://github.com/dogtools/dog
|
||||
[myke]: https://github.com/goeuro/myke
|
||||
[zeus]: https://github.com/dreadl0ck/zeus
|
||||
[godo]: https://github.com/go-godo/godo
|
||||
[grift]: https://github.com/markbates/grift
|
||||
[make.go]: https://github.com/nstratos/make.go
|
||||
[mmake]: https://github.com/tj/mmake
|
||||
[sh]: https://github.com/mvdan/sh
|
||||
[post-hugo]: https://blog.carlmjohnson.net/post/2017/hugo-asset-pipeline/
|
||||
[minify]: https://github.com/tdewolff/minify/tree/master/cmd/minify
|
||||
<p>
|
||||
<a href="https://taskfile.dev/installation/">Installation</a> | <a href="https://taskfile.dev/usage/">Documentation</a> | <a href="https://twitter.com/taskfiledev">Twitter</a> | <a href="https://discord.gg/6TY36E39UK">Discord</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
147
Taskfile.yml
147
Taskfile.yml
@@ -1,55 +1,108 @@
|
||||
# compiles current source code and make "task" executable available on
|
||||
# $GOPATH/bin/task{.exe}
|
||||
install:
|
||||
desc: Installs Task
|
||||
cmds:
|
||||
- go install -v -ldflags="-w -s -X main.version={{.GIT_COMMIT}}" ./cmd/task
|
||||
version: '3'
|
||||
|
||||
dl-deps:
|
||||
desc: Downloads cli dependencies
|
||||
cmds:
|
||||
- go get -u github.com/golang/lint/golint
|
||||
- go get -u github.com/goreleaser/goreleaser
|
||||
- go get -u github.com/asticode/go-astitodo/astitodo
|
||||
- go get -u github.com/golang/dep/cmd/dep
|
||||
includes:
|
||||
docs:
|
||||
aliases: [d]
|
||||
taskfile: ./docs
|
||||
dir: ./docs
|
||||
|
||||
update-deps:
|
||||
desc: Updates dependencies
|
||||
cmds:
|
||||
- dep ensure -update
|
||||
- dep prune
|
||||
vars:
|
||||
GIT_COMMIT:
|
||||
sh: git log -n 1 --format=%h
|
||||
|
||||
clean:
|
||||
desc: Cleans temp files and folders
|
||||
cmds:
|
||||
- rm -rf dist/
|
||||
GO_PACKAGES:
|
||||
sh: go list ./...
|
||||
|
||||
lint:
|
||||
desc: Runs golint
|
||||
cmds:
|
||||
- golint {{.GO_PACKAGES}}
|
||||
silent: true
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
|
||||
test:
|
||||
desc: Runs test suite
|
||||
deps: [install]
|
||||
cmds:
|
||||
- go test ./args
|
||||
- go test
|
||||
tasks:
|
||||
default:
|
||||
cmds:
|
||||
- task: lint
|
||||
- task: test
|
||||
|
||||
# https://github.com/goreleaser/goreleaser
|
||||
release:
|
||||
desc: Release Task
|
||||
cmds:
|
||||
- goreleaser
|
||||
install:
|
||||
desc: Installs Task
|
||||
aliases: [i]
|
||||
sources:
|
||||
- './**/*.go'
|
||||
cmds:
|
||||
- go install -v -ldflags="-w -s -X main.version={{.GIT_COMMIT}}" ./cmd/task
|
||||
|
||||
test-release:
|
||||
desc: Tests release process without publishing
|
||||
cmds:
|
||||
- goreleaser --skip-validate --skip-publish
|
||||
mod:
|
||||
desc: Downloads and tidy Go modules
|
||||
cmds:
|
||||
- go mod download
|
||||
- go mod tidy
|
||||
|
||||
todo:
|
||||
desc: Prints TODO comments present in the code
|
||||
cmds:
|
||||
- astitodo {{.GO_PACKAGES}}
|
||||
silent: true
|
||||
clean:
|
||||
desc: Cleans temp files and folders
|
||||
cmds:
|
||||
- rm -rf dist/
|
||||
- rm -rf tmp/
|
||||
|
||||
lint:
|
||||
desc: Runs golangci-lint
|
||||
aliases: [l]
|
||||
sources:
|
||||
- './**/*.go'
|
||||
cmds:
|
||||
- golangci-lint run
|
||||
|
||||
sleepit:build:
|
||||
desc: Builds the sleepit test helper
|
||||
sources:
|
||||
- ./cmd/sleepit/**/*.go
|
||||
generates:
|
||||
- ./bin/sleepit
|
||||
cmds:
|
||||
- go build -o ./bin/sleepit{{exeExt}} ./cmd/sleepit
|
||||
|
||||
sleepit:run:
|
||||
desc: Builds the sleepit test helper
|
||||
deps: [sleepit:build]
|
||||
cmds:
|
||||
- ./bin/sleepit {{.CLI_ARGS}}
|
||||
silent: true
|
||||
|
||||
test:
|
||||
desc: Runs test suite
|
||||
aliases: [t]
|
||||
deps: [install]
|
||||
cmds:
|
||||
- go test {{catLines .GO_PACKAGES}}
|
||||
|
||||
test:signals:
|
||||
desc: Runs test suite with signals tests included
|
||||
deps: [install, sleepit:build]
|
||||
cmds:
|
||||
- go test {{catLines .GO_PACKAGES}} -tags signals
|
||||
|
||||
test-release:
|
||||
desc: Tests release process without publishing
|
||||
cmds:
|
||||
- goreleaser --snapshot --rm-dist
|
||||
|
||||
docs:changelog:
|
||||
desc: Copy CHANGELOG.md to the documentation website
|
||||
vars:
|
||||
FILE: docs/docs/changelog.md
|
||||
cmds:
|
||||
- rm {{.FILE}}
|
||||
- 'echo "---" >> {{.FILE}}'
|
||||
- 'echo "slug: /changelog/" >> {{.FILE}}'
|
||||
- 'echo "sidebar_position: 6" >> {{.FILE}}'
|
||||
- 'echo "---" >> {{.FILE}}'
|
||||
- 'echo "" >> {{.FILE}}'
|
||||
- 'cat CHANGELOG.md >> {{.FILE}}'
|
||||
|
||||
npm:publish:
|
||||
desc: Publish release to npm
|
||||
cmds:
|
||||
- npm publish --access=public
|
||||
|
||||
packages:
|
||||
cmds:
|
||||
- echo '{{.GO_PACKAGES}}'
|
||||
silent: true
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
GIT_COMMIT:
|
||||
sh: git log -n 1 --format=%h
|
||||
|
||||
GO_PACKAGES:
|
||||
.
|
||||
./args
|
||||
./cmd/task
|
||||
./execext
|
||||
70
args/args.go
70
args/args.go
@@ -1,36 +1,64 @@
|
||||
package args
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/go-task/task"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrVariableWithoutTask is returned when variables are given before any task
|
||||
ErrVariableWithoutTask = errors.New("task: variable given before any task")
|
||||
)
|
||||
|
||||
// Parse parses command line argument: tasks and vars of each task
|
||||
func Parse(args ...string) ([]task.Call, error) {
|
||||
var calls []task.Call
|
||||
// ParseV3 parses command line argument: tasks and global variables
|
||||
func ParseV3(args ...string) ([]taskfile.Call, *taskfile.Vars) {
|
||||
var calls []taskfile.Call
|
||||
var globals = &taskfile.Vars{}
|
||||
|
||||
for _, arg := range args {
|
||||
if !strings.Contains(arg, "=") {
|
||||
calls = append(calls, task.Call{Task: arg})
|
||||
calls = append(calls, taskfile.Call{Task: arg})
|
||||
continue
|
||||
}
|
||||
if len(calls) < 1 {
|
||||
return nil, ErrVariableWithoutTask
|
||||
}
|
||||
|
||||
if calls[len(calls)-1].Vars == nil {
|
||||
calls[len(calls)-1].Vars = make(task.Vars)
|
||||
}
|
||||
|
||||
pair := strings.SplitN(arg, "=", 2)
|
||||
calls[len(calls)-1].Vars[pair[0]] = task.Var{Static: pair[1]}
|
||||
name, value := splitVar(arg)
|
||||
globals.Set(name, taskfile.Var{Static: value})
|
||||
}
|
||||
return calls, nil
|
||||
|
||||
if len(calls) == 0 {
|
||||
calls = append(calls, taskfile.Call{Task: "default"})
|
||||
}
|
||||
|
||||
return calls, globals
|
||||
}
|
||||
|
||||
// ParseV2 parses command line argument: tasks and vars of each task
|
||||
func ParseV2(args ...string) ([]taskfile.Call, *taskfile.Vars) {
|
||||
var calls []taskfile.Call
|
||||
var globals = &taskfile.Vars{}
|
||||
|
||||
for _, arg := range args {
|
||||
if !strings.Contains(arg, "=") {
|
||||
calls = append(calls, taskfile.Call{Task: arg})
|
||||
continue
|
||||
}
|
||||
|
||||
if len(calls) < 1 {
|
||||
name, value := splitVar(arg)
|
||||
globals.Set(name, taskfile.Var{Static: value})
|
||||
} else {
|
||||
if calls[len(calls)-1].Vars == nil {
|
||||
calls[len(calls)-1].Vars = &taskfile.Vars{}
|
||||
}
|
||||
name, value := splitVar(arg)
|
||||
calls[len(calls)-1].Vars.Set(name, taskfile.Var{Static: value})
|
||||
}
|
||||
}
|
||||
|
||||
if len(calls) == 0 {
|
||||
calls = append(calls, taskfile.Call{Task: "default"})
|
||||
}
|
||||
|
||||
return calls, globals
|
||||
}
|
||||
|
||||
func splitVar(s string) (string, string) {
|
||||
pair := strings.SplitN(s, "=", 2)
|
||||
return pair[0], pair[1]
|
||||
}
|
||||
|
||||
@@ -4,21 +4,21 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/go-task/task"
|
||||
"github.com/go-task/task/args"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/go-task/task/v3/args"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
func TestArgs(t *testing.T) {
|
||||
func TestArgsV3(t *testing.T) {
|
||||
tests := []struct {
|
||||
Args []string
|
||||
Expected []task.Call
|
||||
Err error
|
||||
Args []string
|
||||
ExpectedCalls []taskfile.Call
|
||||
ExpectedGlobals *taskfile.Vars
|
||||
}{
|
||||
{
|
||||
Args: []string{"task-a", "task-b", "task-c"},
|
||||
Expected: []task.Call{
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-c"},
|
||||
@@ -26,45 +26,184 @@ func TestArgs(t *testing.T) {
|
||||
},
|
||||
{
|
||||
Args: []string{"task-a", "FOO=bar", "task-b", "task-c", "BAR=baz", "BAZ=foo"},
|
||||
Expected: []task.Call{
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-c"},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
Keys: []string{"FOO", "BAR", "BAZ"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"FOO": taskfile.Var{Static: "bar"},
|
||||
"BAR": taskfile.Var{Static: "baz"},
|
||||
"BAZ": taskfile.Var{Static: "foo"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"task-a", "CONTENT=with some spaces"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
Keys: []string{"CONTENT"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"CONTENT": taskfile.Var{Static: "with some spaces"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"FOO=bar", "task-a", "task-b"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
Keys: []string{"FOO"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"FOO": {Static: "bar"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: nil,
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"FOO=bar", "BAR=baz"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
Keys: []string{"FOO", "BAR"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"FOO": {Static: "bar"},
|
||||
"BAR": {Static: "baz"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
t.Run(fmt.Sprintf("TestArgs%d", i+1), func(t *testing.T) {
|
||||
calls, globals := args.ParseV3(test.Args...)
|
||||
assert.Equal(t, test.ExpectedCalls, calls)
|
||||
if test.ExpectedGlobals.Len() > 0 || globals.Len() > 0 {
|
||||
assert.Equal(t, test.ExpectedGlobals, globals)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestArgsV2(t *testing.T) {
|
||||
tests := []struct {
|
||||
Args []string
|
||||
ExpectedCalls []taskfile.Call
|
||||
ExpectedGlobals *taskfile.Vars
|
||||
}{
|
||||
{
|
||||
Args: []string{"task-a", "task-b", "task-c"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
{Task: "task-c"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"task-a", "FOO=bar", "task-b", "task-c", "BAR=baz", "BAZ=foo"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{
|
||||
Task: "task-a",
|
||||
Vars: task.Vars{
|
||||
"FOO": task.Var{Static: "bar"},
|
||||
Vars: &taskfile.Vars{
|
||||
Keys: []string{"FOO"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"FOO": taskfile.Var{Static: "bar"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{Task: "task-b"},
|
||||
{
|
||||
Task: "task-c",
|
||||
Vars: task.Vars{
|
||||
"BAR": task.Var{Static: "baz"},
|
||||
"BAZ": task.Var{Static: "foo"},
|
||||
Vars: &taskfile.Vars{
|
||||
Keys: []string{"BAR", "BAZ"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"BAR": taskfile.Var{Static: "baz"},
|
||||
"BAZ": taskfile.Var{Static: "foo"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"task-a", "CONTENT=with some spaces"},
|
||||
Expected: []task.Call{
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{
|
||||
Task: "task-a",
|
||||
Vars: task.Vars{
|
||||
"CONTENT": task.Var{Static: "with some spaces"},
|
||||
Vars: &taskfile.Vars{
|
||||
Keys: []string{"CONTENT"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"CONTENT": taskfile.Var{Static: "with some spaces"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"FOO=bar", "task-a"},
|
||||
Err: args.ErrVariableWithoutTask,
|
||||
Args: []string{"FOO=bar", "task-a", "task-b"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "task-a"},
|
||||
{Task: "task-b"},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
Keys: []string{"FOO"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"FOO": {Static: "bar"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: nil,
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Args: []string{"FOO=bar", "BAR=baz"},
|
||||
ExpectedCalls: []taskfile.Call{
|
||||
{Task: "default"},
|
||||
},
|
||||
ExpectedGlobals: &taskfile.Vars{
|
||||
Keys: []string{"FOO", "BAR"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"FOO": {Static: "bar"},
|
||||
"BAR": {Static: "baz"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
t.Run(fmt.Sprintf("TestArgs%d", i+1), func(t *testing.T) {
|
||||
calls, err := args.Parse(test.Args...)
|
||||
assert.Equal(t, test.Err, err)
|
||||
assert.Equal(t, test.Expected, calls)
|
||||
calls, globals := args.ParseV2(test.Args...)
|
||||
assert.Equal(t, test.ExpectedCalls, calls)
|
||||
if test.ExpectedGlobals.Len() > 0 || globals.Len() > 0 {
|
||||
assert.Equal(t, test.ExpectedGlobals, globals)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
173
cmd/sleepit/sleepit.go
Normal file
173
cmd/sleepit/sleepit.go
Normal file
@@ -0,0 +1,173 @@
|
||||
// This code is released under the MIT License
|
||||
// Copyright (c) 2020 Marco Molteni and the timeit contributors.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
)
|
||||
|
||||
const usage = `sleepit: sleep for the specified duration, optionally handling signals
|
||||
When the line "sleepit: ready" is printed, it means that it is safe to send signals to it
|
||||
Usage: sleepit <command> [<args>]
|
||||
Commands
|
||||
default Use default action: on reception of SIGINT terminate abruptly
|
||||
handle Handle signals: on reception of SIGINT perform cleanup before exiting
|
||||
version Show the sleepit version`
|
||||
|
||||
var (
|
||||
// Filled by the linker.
|
||||
fullVersion = "unknown" // example: v0.0.9-8-g941583d027-dirty
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Exit(run(os.Args[1:]))
|
||||
}
|
||||
|
||||
func run(args []string) int {
|
||||
if len(args) < 1 {
|
||||
fmt.Fprintln(os.Stderr, usage)
|
||||
return 2
|
||||
}
|
||||
|
||||
defaultCmd := flag.NewFlagSet("default", flag.ExitOnError)
|
||||
defaultSleep := defaultCmd.Duration("sleep", 5*time.Second, "Sleep duration")
|
||||
|
||||
handleCmd := flag.NewFlagSet("handle", flag.ExitOnError)
|
||||
handleSleep := handleCmd.Duration("sleep", 5*time.Second, "Sleep duration")
|
||||
handleCleanup := handleCmd.Duration("cleanup", 5*time.Second, "Cleanup duration")
|
||||
handleTermAfter := handleCmd.Int("term-after", 0,
|
||||
"Terminate immediately after `N` signals.\n"+
|
||||
"Default is to terminate only when the cleanup phase has completed.")
|
||||
|
||||
versionCmd := flag.NewFlagSet("version", flag.ExitOnError)
|
||||
|
||||
switch args[0] {
|
||||
|
||||
case "default":
|
||||
_ = defaultCmd.Parse(args[1:])
|
||||
if len(defaultCmd.Args()) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "default: unexpected arguments: %v\n", defaultCmd.Args())
|
||||
return 2
|
||||
}
|
||||
return supervisor(*defaultSleep, 0, 0, nil)
|
||||
|
||||
case "handle":
|
||||
_ = handleCmd.Parse(args[1:])
|
||||
if *handleTermAfter == 1 {
|
||||
fmt.Fprintf(os.Stderr, "handle: term-after cannot be 1\n")
|
||||
return 2
|
||||
}
|
||||
if len(handleCmd.Args()) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "handle: unexpected arguments: %v\n", handleCmd.Args())
|
||||
return 2
|
||||
}
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, os.Interrupt) // Ctrl-C -> SIGINT
|
||||
return supervisor(*handleSleep, *handleCleanup, *handleTermAfter, sigCh)
|
||||
|
||||
case "version":
|
||||
_ = versionCmd.Parse(args[1:])
|
||||
if len(versionCmd.Args()) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "version: unexpected arguments: %v\n", versionCmd.Args())
|
||||
return 2
|
||||
}
|
||||
fmt.Printf("sleepit version %s\n", fullVersion)
|
||||
return 0
|
||||
|
||||
default:
|
||||
fmt.Fprintln(os.Stderr, usage)
|
||||
return 2
|
||||
}
|
||||
}
|
||||
|
||||
func supervisor(
|
||||
sleep time.Duration,
|
||||
cleanup time.Duration,
|
||||
termAfter int,
|
||||
sigCh <-chan os.Signal,
|
||||
) int {
|
||||
fmt.Printf("sleepit: ready\n")
|
||||
fmt.Printf("sleepit: PID=%d sleep=%v cleanup=%v\n",
|
||||
os.Getpid(), sleep, cleanup)
|
||||
|
||||
cancelWork := make(chan struct{})
|
||||
workerDone := worker(cancelWork, sleep, "work")
|
||||
|
||||
cancelCleaner := make(chan struct{})
|
||||
var cleanerDone <-chan struct{}
|
||||
|
||||
sigCount := 0
|
||||
for {
|
||||
select {
|
||||
case sig := <-sigCh:
|
||||
sigCount++
|
||||
fmt.Printf("sleepit: got signal=%s count=%d\n", sig, sigCount)
|
||||
if sigCount == 1 {
|
||||
// since `cancelWork` is unbuffered, sending will be synchronous:
|
||||
// we are ensured that the worker has terminated before starting cleanup.
|
||||
// This is important in some real-life situations.
|
||||
cancelWork <- struct{}{}
|
||||
cleanerDone = worker(cancelCleaner, cleanup, "cleanup")
|
||||
}
|
||||
if sigCount == termAfter {
|
||||
cancelCleaner <- struct{}{}
|
||||
return 4
|
||||
}
|
||||
case <-workerDone:
|
||||
return 0
|
||||
case <-cleanerDone:
|
||||
return 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start a worker goroutine and return immediately a `workerDone` channel.
|
||||
// The goroutine will prepend its prints with the prefix `name`.
|
||||
// The goroutine will simulate some work and will terminate when one of the following
|
||||
// conditions happens:
|
||||
// 1. When `howlong` is elapsed. This case will be signaled on the `workerDone` channel.
|
||||
// 2. When something happens on channel `canceled`. Note that this simulates real-life,
|
||||
// so cancellation is not instantaneous: if the caller wants a synchronous cancel,
|
||||
// it should send a message; if instead it wants an asynchronous cancel, it should
|
||||
// close the channel.
|
||||
func worker(
|
||||
canceled <-chan struct{},
|
||||
howlong time.Duration,
|
||||
name string,
|
||||
) <-chan struct{} {
|
||||
workerDone := make(chan struct{})
|
||||
deadline := time.Now().Add(howlong)
|
||||
go func() {
|
||||
fmt.Printf("sleepit: %s started\n", name)
|
||||
for {
|
||||
select {
|
||||
case <-canceled:
|
||||
fmt.Printf("sleepit: %s canceled\n", name)
|
||||
return
|
||||
default:
|
||||
if doSomeWork(deadline) {
|
||||
fmt.Printf("sleepit: %s done\n", name) // <== NOTE THIS LINE
|
||||
workerDone <- struct{}{}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return workerDone
|
||||
}
|
||||
|
||||
// Do some work and then return, so that the caller can decide wether to continue or not.
|
||||
// Return true when all work is done.
|
||||
func doSomeWork(deadline time.Time) bool {
|
||||
if time.Now().After(deadline) {
|
||||
return true
|
||||
}
|
||||
timeout := 100 * time.Millisecond
|
||||
time.Sleep(timeout)
|
||||
return false
|
||||
}
|
||||
219
cmd/task/task.go
219
cmd/task/task.go
@@ -1,21 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/go-task/task"
|
||||
"github.com/go-task/task/args"
|
||||
"path/filepath"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
"mvdan.cc/sh/v3/syntax"
|
||||
|
||||
"github.com/go-task/task/v3"
|
||||
"github.com/go-task/task/v3/args"
|
||||
"github.com/go-task/task/v3/internal/logger"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
var (
|
||||
version = "master"
|
||||
version = ""
|
||||
)
|
||||
|
||||
const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [task...]
|
||||
const usage = `Usage: task [-ilfwvsd] [--init] [--list] [--force] [--watch] [--verbose] [--silent] [--dir] [--taskfile] [--dry] [--summary] [task...]
|
||||
|
||||
Runs the specified task(s). Falls back to the "default" task if no task name
|
||||
was specified, or lists all tasks if an unknown task name was specified.
|
||||
@@ -24,12 +31,14 @@ Example: 'task hello' with the following 'Taskfile.yml' file will generate an
|
||||
'output.txt' file with the content "hello".
|
||||
|
||||
'''
|
||||
hello:
|
||||
cmds:
|
||||
- echo "I am going to write a file named 'output.txt' now."
|
||||
- echo "hello" > output.txt
|
||||
generates:
|
||||
- output.txt
|
||||
version: '3'
|
||||
tasks:
|
||||
hello:
|
||||
cmds:
|
||||
- echo "I am going to write a file named 'output.txt' now."
|
||||
- echo "hello" > output.txt
|
||||
generates:
|
||||
- output.txt
|
||||
'''
|
||||
|
||||
Options:
|
||||
@@ -37,35 +46,67 @@ Options:
|
||||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
log.SetOutput(os.Stderr)
|
||||
|
||||
pflag.Usage = func() {
|
||||
fmt.Print(usage)
|
||||
log.Print(usage)
|
||||
pflag.PrintDefaults()
|
||||
}
|
||||
|
||||
var (
|
||||
versionFlag bool
|
||||
helpFlag bool
|
||||
init bool
|
||||
list bool
|
||||
listAll bool
|
||||
status bool
|
||||
force bool
|
||||
watch bool
|
||||
verbose bool
|
||||
silent bool
|
||||
dry bool
|
||||
summary bool
|
||||
exitCode bool
|
||||
parallel bool
|
||||
concurrency int
|
||||
dir string
|
||||
entrypoint string
|
||||
output taskfile.Output
|
||||
color bool
|
||||
interval string
|
||||
)
|
||||
|
||||
pflag.BoolVar(&versionFlag, "version", false, "show Task version")
|
||||
pflag.BoolVarP(&init, "init", "i", false, "creates a new Taskfile.yml in the current folder")
|
||||
pflag.BoolVarP(&helpFlag, "help", "h", false, "shows Task usage")
|
||||
pflag.BoolVarP(&init, "init", "i", false, "creates a new Taskfile.yaml in the current folder")
|
||||
pflag.BoolVarP(&list, "list", "l", false, "lists tasks with description of current Taskfile")
|
||||
pflag.BoolVarP(&listAll, "list-all", "a", false, "lists tasks with or without a description")
|
||||
pflag.BoolVar(&status, "status", false, "exits with non-zero exit code if any of the given tasks is not up-to-date")
|
||||
pflag.BoolVarP(&force, "force", "f", false, "forces execution even when the task is up-to-date")
|
||||
pflag.BoolVarP(&watch, "watch", "w", false, "enables watch of the given task")
|
||||
pflag.BoolVarP(&verbose, "verbose", "v", false, "enables verbose mode")
|
||||
pflag.BoolVarP(&silent, "silent", "s", false, "disables echoing")
|
||||
pflag.BoolVarP(¶llel, "parallel", "p", false, "executes tasks provided on command line in parallel")
|
||||
pflag.BoolVarP(&dry, "dry", "n", false, "compiles and prints tasks in the order that they would be run, without executing them")
|
||||
pflag.BoolVar(&summary, "summary", false, "show summary about a task")
|
||||
pflag.BoolVarP(&exitCode, "exit-code", "x", false, "pass-through the exit code of the task command")
|
||||
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(&output.Name, "output", "o", "", "sets output style: [interleaved|group|prefixed]")
|
||||
pflag.StringVar(&output.Group.Begin, "output-group-begin", "", "message template to print before a task's grouped output")
|
||||
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 {
|
||||
log.Printf("Task version: %s\n", version)
|
||||
fmt.Printf("Task version: %s\n", getVersion())
|
||||
return
|
||||
}
|
||||
|
||||
if helpFlag {
|
||||
pflag.Usage()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -80,38 +121,154 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if dir != "" && entrypoint != "" {
|
||||
log.Fatal("task: You can't set both --dir and --taskfile")
|
||||
return
|
||||
}
|
||||
if entrypoint != "" {
|
||||
dir = filepath.Dir(entrypoint)
|
||||
entrypoint = filepath.Base(entrypoint)
|
||||
}
|
||||
|
||||
if output.Name != "group" {
|
||||
if output.Group.Begin != "" {
|
||||
log.Fatal("task: You can't set --output-group-begin without --output=group")
|
||||
return
|
||||
}
|
||||
if output.Group.End != "" {
|
||||
log.Fatal("task: You can't set --output-group-end without --output=group")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
e := task.Executor{
|
||||
Force: force,
|
||||
Watch: watch,
|
||||
Verbose: verbose,
|
||||
Silent: silent,
|
||||
Dir: dir,
|
||||
Force: force,
|
||||
Watch: watch,
|
||||
Verbose: verbose,
|
||||
Silent: silent,
|
||||
Dir: dir,
|
||||
Dry: dry,
|
||||
Entrypoint: entrypoint,
|
||||
Summary: summary,
|
||||
Parallel: parallel,
|
||||
Color: color,
|
||||
Concurrency: concurrency,
|
||||
Interval: interval,
|
||||
|
||||
Stdin: os.Stdin,
|
||||
Stdout: os.Stdout,
|
||||
Stderr: os.Stderr,
|
||||
}
|
||||
if err := e.ReadTaskfile(); err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
OutputStyle: output,
|
||||
}
|
||||
|
||||
if list {
|
||||
e.PrintTasksHelp()
|
||||
if (list || listAll) && silent {
|
||||
e.ListTaskNames(listAll)
|
||||
return
|
||||
}
|
||||
|
||||
arguments := pflag.Args()
|
||||
if len(arguments) == 0 {
|
||||
log.Println("task: No argument given, trying default task")
|
||||
arguments = []string{"default"}
|
||||
if err := e.Setup(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
v, err := e.Taskfile.ParsedVersion()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
}
|
||||
|
||||
calls, err := args.Parse(arguments...)
|
||||
if list {
|
||||
if ok := e.ListTasks(task.FilterOutInternal(), task.FilterOutNoDesc()); !ok {
|
||||
e.Logger.Outf(logger.Yellow, "task: No tasks with description available. Try --list-all to list all tasks")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if listAll {
|
||||
if ok := e.ListTasks(task.FilterOutInternal()); !ok {
|
||||
e.Logger.Outf(logger.Yellow, "task: No tasks available")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
calls []taskfile.Call
|
||||
globals *taskfile.Vars
|
||||
)
|
||||
|
||||
tasksAndVars, cliArgs, err := getArgs()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := e.Run(calls...); err != nil {
|
||||
log.Fatal(err)
|
||||
if v >= 3.0 {
|
||||
calls, globals = args.ParseV3(tasksAndVars...)
|
||||
} else {
|
||||
calls, globals = args.ParseV2(tasksAndVars...)
|
||||
}
|
||||
|
||||
globals.Set("CLI_ARGS", taskfile.Var{Static: cliArgs})
|
||||
e.Taskfile.Vars.Merge(globals)
|
||||
|
||||
if !watch {
|
||||
e.InterceptInterruptSignals()
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
if status {
|
||||
if err := e.Status(ctx, calls...); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err := e.Run(ctx, calls...); err != nil {
|
||||
e.Logger.Errf(logger.Red, "%v", err)
|
||||
|
||||
if exitCode {
|
||||
if err, ok := err.(*task.TaskRunError); ok {
|
||||
os.Exit(err.ExitCode())
|
||||
}
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func getArgs() ([]string, string, error) {
|
||||
var (
|
||||
args = pflag.Args()
|
||||
doubleDashPos = pflag.CommandLine.ArgsLenAtDash()
|
||||
)
|
||||
|
||||
if doubleDashPos == -1 {
|
||||
return args, "", nil
|
||||
}
|
||||
|
||||
var quotedCliArgs []string
|
||||
for _, arg := range args[doubleDashPos:] {
|
||||
quotedCliArg, err := syntax.Quote(arg, syntax.LangBash)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
quotedCliArgs = append(quotedCliArgs, quotedCliArg)
|
||||
}
|
||||
return args[:doubleDashPos], strings.Join(quotedCliArgs, " "), nil
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
84
command.go
84
command.go
@@ -1,84 +0,0 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Cmd is a task command
|
||||
type Cmd struct {
|
||||
Cmd string
|
||||
Silent bool
|
||||
Task string
|
||||
Vars Vars
|
||||
}
|
||||
|
||||
// Dep is a task dependency
|
||||
type Dep struct {
|
||||
Task string
|
||||
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
|
||||
func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var cmd string
|
||||
if err := unmarshal(&cmd); err == nil {
|
||||
if strings.HasPrefix(cmd, "^") {
|
||||
c.Task = strings.TrimPrefix(cmd, "^")
|
||||
} else {
|
||||
c.Cmd = cmd
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var cmdStruct struct {
|
||||
Cmd string
|
||||
Silent bool
|
||||
}
|
||||
if err := unmarshal(&cmdStruct); err == nil && cmdStruct.Cmd != "" {
|
||||
c.Cmd = cmdStruct.Cmd
|
||||
c.Silent = cmdStruct.Silent
|
||||
return nil
|
||||
}
|
||||
var taskCall struct {
|
||||
Task string
|
||||
Vars Vars
|
||||
}
|
||||
if err := unmarshal(&taskCall); err == nil {
|
||||
c.Task = taskCall.Task
|
||||
c.Vars = taskCall.Vars
|
||||
return nil
|
||||
}
|
||||
return ErrCantUnmarshalCmd
|
||||
}
|
||||
|
||||
// UnmarshalYAML implements yaml.Unmarshaler interface
|
||||
func (d *Dep) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var task string
|
||||
if err := unmarshal(&task); err == nil {
|
||||
d.Task = task
|
||||
return nil
|
||||
}
|
||||
var taskCall struct {
|
||||
Task string
|
||||
Vars Vars
|
||||
}
|
||||
if err := unmarshal(&taskCall); err == nil {
|
||||
d.Task = taskCall.Task
|
||||
d.Vars = taskCall.Vars
|
||||
return nil
|
||||
}
|
||||
return ErrCantUnmarshalDep
|
||||
}
|
||||
|
||||
// Call is the parameters to a task call
|
||||
type Call struct {
|
||||
Task string
|
||||
Vars Vars
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package task_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-task/task"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
func TestCmdParse(t *testing.T) {
|
||||
const (
|
||||
yamlCmd = `echo "a string command"`
|
||||
yamlDep = `"task-name"`
|
||||
yamlTaskCall = `
|
||||
task: another-task
|
||||
vars:
|
||||
PARAM1: VALUE1
|
||||
PARAM2: VALUE2
|
||||
`
|
||||
)
|
||||
tests := []struct {
|
||||
content string
|
||||
v interface{}
|
||||
expected interface{}
|
||||
}{
|
||||
{
|
||||
yamlCmd,
|
||||
&task.Cmd{},
|
||||
&task.Cmd{Cmd: `echo "a string command"`},
|
||||
},
|
||||
{
|
||||
yamlTaskCall,
|
||||
&task.Cmd{},
|
||||
&task.Cmd{Task: "another-task", Vars: task.Vars{
|
||||
"PARAM1": task.Var{Static: "VALUE1"},
|
||||
"PARAM2": task.Var{Static: "VALUE2"},
|
||||
}},
|
||||
},
|
||||
{
|
||||
yamlDep,
|
||||
&task.Dep{},
|
||||
&task.Dep{Task: "task-name"},
|
||||
},
|
||||
{
|
||||
yamlTaskCall,
|
||||
&task.Dep{},
|
||||
&task.Dep{Task: "another-task", Vars: task.Vars{
|
||||
"PARAM1": task.Var{Static: "VALUE1"},
|
||||
"PARAM2": task.Var{Static: "VALUE2"},
|
||||
}},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
err := yaml.Unmarshal([]byte(test.content), test.v)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, test.expected, test.v)
|
||||
}
|
||||
}
|
||||
55
completion/bash/task.bash
Normal file
55
completion/bash/task.bash
Normal file
@@ -0,0 +1,55 @@
|
||||
# vim: set tabstop=2 shiftwidth=2 expandtab:
|
||||
|
||||
_GO_TASK_COMPLETION_LIST_OPTION='--list-all'
|
||||
|
||||
function _task()
|
||||
{
|
||||
local cur prev words cword
|
||||
_init_completion -n : || return
|
||||
|
||||
# Check for `--` within command-line and quit or strip suffix.
|
||||
local i
|
||||
for i in "${!words[@]}"; do
|
||||
if [ "${words[$i]}" == "--" ]; then
|
||||
# Do not complete words following `--` passed to CLI_ARGS.
|
||||
[ $cword -gt $i ] && return
|
||||
# Remove the words following `--` to not put --list in CLI_ARGS.
|
||||
words=( "${words[@]:0:$i}" )
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Handle special arguments of options.
|
||||
case "$prev" in
|
||||
-d|--dir)
|
||||
_filedir -d
|
||||
return $?
|
||||
;;
|
||||
-t|--taskfile)
|
||||
_filedir yaml || return $?
|
||||
_filedir yml
|
||||
return $?
|
||||
;;
|
||||
-o|--output)
|
||||
COMPREPLY=( $( compgen -W "interleaved group prefixed" -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Handle normal options.
|
||||
case "$cur" in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Prepare task name completions.
|
||||
local tasks=( $( "${words[@]}" --silent $_GO_TASK_COMPLETION_LIST_OPTION 2> /dev/null ) )
|
||||
COMPREPLY=( $( compgen -W "${tasks[*]}" -- "$cur" ) )
|
||||
|
||||
# Post-process because task names might contain colons.
|
||||
__ltrim_colon_completions "$cur"
|
||||
}
|
||||
|
||||
complete -F _task task
|
||||
37
completion/fish/task.fish
Normal file
37
completion/fish/task.fish
Normal file
@@ -0,0 +1,37 @@
|
||||
set GO_TASK_PROGNAME task
|
||||
|
||||
function __task_get_tasks --description "Prints all available tasks with their description"
|
||||
# Read the list of tasks (and potential errors)
|
||||
$GO_TASK_PROGNAME --list-all 2>&1 | read -lz rawOutput
|
||||
|
||||
# Return on non-zero exit code (for cases when there is no Taskfile found or etc.)
|
||||
if test $status -ne 0
|
||||
return
|
||||
end
|
||||
|
||||
# Grab names and descriptions (if any) of the tasks
|
||||
set -l output (echo $rawOutput | sed '1d; s/\* \(.*\):\s*\(.*\)/\1\t\2/' | string split0)
|
||||
if test $output
|
||||
echo $output
|
||||
end
|
||||
end
|
||||
|
||||
complete -c $GO_TASK_PROGNAME -d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was
|
||||
specified.' -xa "(__task_get_tasks)"
|
||||
|
||||
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
|
||||
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
|
||||
complete -c $GO_TASK_PROGNAME -l dry -d 'compiles and prints tasks in the order that they would be run, without executing them'
|
||||
complete -c $GO_TASK_PROGNAME -s f -l force -d 'forces execution even when the task is up-to-date'
|
||||
complete -c $GO_TASK_PROGNAME -s h -l help -d 'shows Task usage'
|
||||
complete -c $GO_TASK_PROGNAME -s i -l init -d 'creates a new Taskfile.yml in the current folder'
|
||||
complete -c $GO_TASK_PROGNAME -s l -l list -d 'lists tasks with description of current Taskfile'
|
||||
complete -c $GO_TASK_PROGNAME -s o -l output -d 'sets output style: [interleaved|group|prefixed]' -xa "interleaved group prefixed"
|
||||
complete -c $GO_TASK_PROGNAME -s p -l parallel -d 'executes tasks provided on command line in parallel'
|
||||
complete -c $GO_TASK_PROGNAME -s s -l silent -d 'disables echoing'
|
||||
complete -c $GO_TASK_PROGNAME -l status -d 'exits with non-zero exit code if any of the given tasks is not up-to-date'
|
||||
complete -c $GO_TASK_PROGNAME -l summary -d 'show summary about a task'
|
||||
complete -c $GO_TASK_PROGNAME -s t -l taskfile -d 'choose which Taskfile to run. Defaults to "Taskfile.yml"'
|
||||
complete -c $GO_TASK_PROGNAME -s v -l verbose -d 'enables verbose mode'
|
||||
complete -c $GO_TASK_PROGNAME -l version -d 'show Task version'
|
||||
complete -c $GO_TASK_PROGNAME -s w -l watch -d 'enables watch of the given task'
|
||||
8
completion/ps/task.ps1
Normal file
8
completion/ps/task.ps1
Normal file
@@ -0,0 +1,8 @@
|
||||
$scriptBlock = {
|
||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters )
|
||||
$reg = "\* ($commandName.+?):"
|
||||
$listOutput = $(task --list-all)
|
||||
$listOutput | Select-String $reg -AllMatches | ForEach-Object { $_.Matches.Groups[1].Value }
|
||||
}
|
||||
|
||||
Register-ArgumentCompleter -CommandName task -ScriptBlock $scriptBlock
|
||||
62
completion/zsh/_task
Executable file
62
completion/zsh/_task
Executable file
@@ -0,0 +1,62 @@
|
||||
#compdef task
|
||||
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
_GO_TASK_COMPLETION_LIST_OPTION="${GO_TASK_COMPLETION_LIST_OPTION:---list-all}"
|
||||
|
||||
# Listing commands from Taskfile.yml
|
||||
function __task_list() {
|
||||
local -a scripts cmd
|
||||
local -i enabled=0
|
||||
local taskfile item task desc
|
||||
|
||||
cmd=(task)
|
||||
taskfile="${(v)opt_args[(i)-t|--taskfile]}"
|
||||
|
||||
if [[ -n "$taskfile" && -f "$taskfile" ]]; then
|
||||
enabled=1
|
||||
cmd+=(--taskfile "$taskfile")
|
||||
else
|
||||
for taskfile in Taskfile{,.dist}.{yaml,yml}; do
|
||||
if [[ -f "$taskfile" ]]; then
|
||||
enabled=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
(( enabled )) || return 0
|
||||
|
||||
scripts=()
|
||||
for item in "${(@)${(f)$("${cmd[@]}" $_GO_TASK_COMPLETION_LIST_OPTION)}[2,-1]#\* }"; do
|
||||
task="${item%%:[[:space:]]*}"
|
||||
desc="${item##[^[:space:]]##[[:space:]]##}"
|
||||
scripts+=( "${task//:/\\:}:$desc" )
|
||||
done
|
||||
_describe 'Task to run' scripts
|
||||
}
|
||||
|
||||
_arguments \
|
||||
'(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \
|
||||
'(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \
|
||||
'(-f --force)'{-f,--force}'[run even if task is up-to-date]' \
|
||||
'(-c --color)'{-c,--color}'[colored output]' \
|
||||
'(-d --dir)'{-d,--dir}'[dir to run in]:execution dir:_dirs' \
|
||||
'(--dry)--dry[dry-run mode, compile and print tasks only]' \
|
||||
'(-o --output)'{-o,--output}'[set output style]:style:(interleaved group prefixed)' \
|
||||
'(--output-group-begin)--output-group-begin[message template before grouped output]:template text: ' \
|
||||
'(--output-group-end)--output-group-end[message template after grouped output]:template text: ' \
|
||||
'(-s --silent)'{-s,--silent}'[disable echoing]' \
|
||||
'(--status)--status[exit non-zero if supplied tasks not up-to-date]' \
|
||||
'(--summary)--summary[show summary\: field from tasks instead of running them]' \
|
||||
'(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \
|
||||
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
|
||||
'(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \
|
||||
+ '(operation)' \
|
||||
{-l,--list}'[list describable tasks]' \
|
||||
{-a,--list-all}'[list all tasks]' \
|
||||
{-i,--init}'[create new Taskfile.yaml]' \
|
||||
'(-*)'{-h,--help}'[show help]' \
|
||||
'(-*)--version[show version and exit]' \
|
||||
'*: :__task_list'
|
||||
25
concurrency.go
Normal file
25
concurrency.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package task
|
||||
|
||||
func (e *Executor) acquireConcurrencyLimit() func() {
|
||||
if e.concurrencySemaphore == nil {
|
||||
return emptyFunc
|
||||
}
|
||||
|
||||
e.concurrencySemaphore <- struct{}{}
|
||||
return func() {
|
||||
<-e.concurrencySemaphore
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Executor) releaseConcurrencyLimit() func() {
|
||||
if e.concurrencySemaphore == nil {
|
||||
return emptyFunc
|
||||
}
|
||||
|
||||
<-e.concurrencySemaphore
|
||||
return func() {
|
||||
e.concurrencySemaphore <- struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
func emptyFunc() {}
|
||||
20
docs/.gitignore
vendored
Normal file
20
docs/.gitignore
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# Dependencies
|
||||
/node_modules
|
||||
|
||||
# Production
|
||||
/build
|
||||
|
||||
# Generated files
|
||||
.docusaurus
|
||||
.cache-loader
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
0
docs/.nojekyll
Normal file
0
docs/.nojekyll
Normal file
37
docs/Taskfile.yml
Normal file
37
docs/Taskfile.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
yarn:install:
|
||||
desc: Setup Docusaurus locally
|
||||
cmds:
|
||||
- yarn install
|
||||
sources:
|
||||
- package.json
|
||||
- yarn.lock
|
||||
|
||||
default:
|
||||
desc: Start website
|
||||
deps: [yarn:install]
|
||||
aliases: [s, start]
|
||||
vars:
|
||||
HOST: '{{default "localhost" .HOST}}'
|
||||
PORT: '{{default "3001" .PORT}}'
|
||||
cmds:
|
||||
- npx docusaurus start --no-open --host={{.HOST}} --port={{.PORT}}
|
||||
|
||||
build:
|
||||
desc: Build website
|
||||
deps: [yarn:install]
|
||||
cmds:
|
||||
- npx docusaurus build
|
||||
|
||||
clean:
|
||||
desc: Clean temp directories
|
||||
cmds:
|
||||
- rm -rf ./build
|
||||
|
||||
deploy:
|
||||
desc: Build and deploy Docusaurus
|
||||
summary: Requires GIT_USER and GIT_PASS envs to be previous set
|
||||
cmds:
|
||||
- npx docusaurus deploy
|
||||
3
docs/babel.config.js
Normal file
3
docs/babel.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
|
||||
};
|
||||
5
docs/blog/authors.yml
Normal file
5
docs/blog/authors.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
andreynering:
|
||||
name: Andrey Nering
|
||||
title: Maintainer of Task
|
||||
url: https://github.com/andreynering
|
||||
image_url: https://github.com/andreynering.png
|
||||
243
docs/docs/api_reference.md
Normal file
243
docs/docs/api_reference.md
Normal file
@@ -0,0 +1,243 @@
|
||||
---
|
||||
slug: /api/
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# API Reference
|
||||
|
||||
## CLI
|
||||
|
||||
Task command line tool has the following syntax:
|
||||
|
||||
```bash
|
||||
task [--flags] [tasks...] [-- CLI_ARGS...]
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
If `--` is given, all remaning arguments will be assigned to a special `CLI_ARGS`
|
||||
variable
|
||||
|
||||
:::
|
||||
|
||||
| Short | Flag | Type | Default | Description |
|
||||
| - | - | - | - | - |
|
||||
| `-c` | `--color` | `bool` | `true` | Colored output. Enabled by default. Set flag to `false` or use `NO_COLOR=1` to disable. |
|
||||
| `-C` | `--concurrency` | `int` | `0` | Limit number tasks to run concurrently. Zero means unlimited. |
|
||||
| `-d` | `--dir` | `string` | Working directory | Sets directory of execution. |
|
||||
| `-n` | `--dry` | `bool` | `false` | Compiles and prints tasks in the order that they would be run, without executing them. |
|
||||
| `-x` | `--exit-code` | `bool` | `false` | Pass-through the exit code of the task command. |
|
||||
| `-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`]. |
|
||||
| | `--output-group-begin` | `string` | | Message template to print before a task's grouped output. |
|
||||
| | `--output-group-end` | `string` | | Message template to print after a task's grouped output. |
|
||||
| `-p` | `--parallel` | `bool` | `false` | Executes tasks provided on command line in parallel. |
|
||||
| `-s` | `--silent` | `bool` | `false` | Disables echoing. |
|
||||
| | `--status` | `bool` | `false` | Exits with non-zero exit code if any of the given tasks is not up-to-date. |
|
||||
| | `--summary` | `bool` | `false` | Show summary about a task. |
|
||||
| `-t` | `--taskfile` | `string` | `Taskfile.yml` or `Taskfile.yaml` | |
|
||||
| `-v` | `--verbose` | `bool` | `false` | Enables verbose mode. |
|
||||
| | `--version` | `bool` | `false` | Show Task version. |
|
||||
| `-w` | `--watch` | `bool` | `false` | Enables watch of the given task. |
|
||||
|
||||
## Special Variables
|
||||
|
||||
There are some special variables that is available on the templating system:
|
||||
|
||||
| Var | Description |
|
||||
| - | - |
|
||||
| `CLI_ARGS` | Contain all extra arguments passed after `--` when calling Task through the CLI. |
|
||||
| `TASK` | The name of the current task. |
|
||||
| `ROOT_DIR` | The absolute path of the root Taskfile. |
|
||||
| `TASKFILE_DIR` | The absolute path of the included Taskfile. |
|
||||
| `CHECKSUM` | The checksum of the files listed in `sources`. Only available within the `status` prop and if method is set to `checksum`. |
|
||||
| `TIMESTAMP` | The date object of the greatest timestamp of the files listes in `sources`. Only available within the `status` prop and if method is set to `timestamp`. |
|
||||
|
||||
## ENV
|
||||
|
||||
Some environment variables can be overriden to adjust Task behavior.
|
||||
|
||||
| ENV | Default | Description |
|
||||
| - | - | - |
|
||||
| `TASK_TEMP_DIR` | `.task` | Location of the temp dir. Can relative to the project like `tmp/task` or absolute like `/tmp/.task` or `~/.task`. |
|
||||
| `TASK_COLOR_RESET` | `0` | Color used for white. |
|
||||
| `TASK_COLOR_BLUE` | `34` | Color used for blue. |
|
||||
| `TASK_COLOR_GREEN` | `32` | Color used for green. |
|
||||
| `TASK_COLOR_CYAN` | `36` | Color used for cyan. |
|
||||
| `TASK_COLOR_YELLOW` | `33` | Color used for yellow. |
|
||||
| `TASK_COLOR_MAGENTA` | `35` | Color used for magenta. |
|
||||
| `TASK_COLOR_RED` | `31` | Color used for red. |
|
||||
|
||||
## Schema
|
||||
|
||||
### Taskfile
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| - | - | - | - |
|
||||
| `version` | `string` | | Version of the Taskfile. The current version is `3`. |
|
||||
| `output` | `string` | `interleaved` | Output mode. Available options: `interleaved`, `group` and `prefixed`. |
|
||||
| `method` | `string` | `checksum` | Default method in this Taskfile. Can be overriden in a task by task basis. Available options: `checksum`, `timestamp` and `none`. |
|
||||
| `includes` | [`map[string]Include`](#include) | | Additional Taskfiles to be included. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | A set of global variables. |
|
||||
| `env` | [`map[string]Variable`](#variable) | | A set of global environment variables. |
|
||||
| `tasks` | [`map[string]Task`](#task) | | A set of task definitions. |
|
||||
| `silent` | `bool` | `false` | Default 'silent' options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis. |
|
||||
| `dotenv` | `[]string` | | A list of `.env` file paths to be parsed. |
|
||||
| `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). |
|
||||
|
||||
### Include
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| - | - | - | - |
|
||||
| `taskfile` | `string` | | The path for the Taskfile or directory to be included. If a directory, Task will look for files named `Taskfile.yml` or `Taskfile.yaml` inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile. |
|
||||
| `dir` | `string` | The parent Taskfile directory | The working directory of the included tasks when run. |
|
||||
| `optional` | `bool` | `false` | If `true`, no errors will be thrown if the specified file does not exist. |
|
||||
| `internal` | `bool` | `false` | Stops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with `--list`. |
|
||||
| `aliases` | `[]string` | | Alternative names for the namespace of the included Taskfile. |
|
||||
| `vars` | `map[string]Variable` | | A set of variables to apply to the included Taskfile. |
|
||||
|
||||
:::info
|
||||
|
||||
Informing only a string like below is equivalent to setting that value to the `taskfile` attribute.
|
||||
|
||||
```yaml
|
||||
includes:
|
||||
foo: ./path
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Task
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| - | - | - | - |
|
||||
| `cmds` | [`[]Command`](#command) | | A list of shell commands to be executed. |
|
||||
| `deps` | [`[]Dependency`](#dependency) | | A list of dependencies of this task. Tasks defined here will run in parallel before this task. |
|
||||
| `label` | `string` | | Overrides the name of the task in the output when a task is run. Supports variables. |
|
||||
| `desc` | `string` | | A short description of the task. This is displayed when calling `task --list`. |
|
||||
| `summary` | `string` | | A longer description of the task. This is displayed when calling `task --summary [task]`. |
|
||||
| `aliases` | `[]string` | | A list of alternative names by which the task can be called. |
|
||||
| `sources` | `[]string` | | A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs. |
|
||||
| `generates` | `[]string` | | A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs. |
|
||||
| `status` | `[]string` | | A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`. |
|
||||
| `preconditions` | [`[]Precondition`](#precondition) | | A list of commands to check if this task should run. If a condition is not met, the task will error. |
|
||||
| `dir` | `string` | | The directory in which this task should run. Defaults to the current working directory. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | A set of variables that can be used in the task. |
|
||||
| `env` | [`map[string]Variable`](#variable) | | A set of environment variables that will be made available to shell commands. |
|
||||
| `silent` | `bool` | `false` | Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. When combined with the `--list` flag, task descriptions will be hidden. |
|
||||
| `interactive` | `bool` | `false` | Tells task that the command is interactive. |
|
||||
| `internal` | `bool` | `false` | Stops a task from being callable on the command line. It will also be omitted from the output when used with `--list`. |
|
||||
| `method` | `string` | `checksum` | Defines which method is used to check the task is up-to-date. `timestamp` will compare the timestamp of the sources and generates files. `checksum` will check the checksum (You probably want to ignore the .task folder in your .gitignore file). `none` skips any validation and always run the task. |
|
||||
| `prefix` | `string` | | Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is `prefixed`. |
|
||||
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing commands. |
|
||||
| `run` | `string` | The one declared globally in the Taskfile or `always` | Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`. |
|
||||
|
||||
:::info
|
||||
|
||||
These alternative syntaxes are available. They will set the given values to
|
||||
`cmds` and everything else will be set to their default values:
|
||||
|
||||
```yaml
|
||||
tasks:
|
||||
foo: echo "foo"
|
||||
|
||||
foobar:
|
||||
- echo "foo"
|
||||
- echo "bar"
|
||||
|
||||
baz:
|
||||
cmd: echo "baz"
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Dependency
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| - | - | - | - |
|
||||
| `task` | `string` | | The task to be execute as a dependency. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to this task. |
|
||||
|
||||
:::tip
|
||||
|
||||
If you don't want to set additional variables, it's enough to declare the
|
||||
dependency as a list of strings (they will be assigned to `task`):
|
||||
|
||||
```yaml
|
||||
tasks:
|
||||
foo:
|
||||
deps: [foo, bar]
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Command
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| - | - | - | - |
|
||||
| `cmd` | `string` | | The shell command to be executed. |
|
||||
| `silent` | `bool` | `false` | Skips some output for this command. Note that STDOUT and STDERR of the commands will still be redirected. |
|
||||
| `task` | `string` | | Set this to trigger execution of another task instead of running a command. This cannot be set together with `cmd`. |
|
||||
| `vars` | [`map[string]Variable`](#variable) | | Optional additional variables to be passed to the referenced task. Only relevant when setting `task` instead of `cmd`. |
|
||||
| `ignore_error` | `bool` | `false` | Continue execution if errors happen while executing the command. |
|
||||
| `defer` | `string` | | Alternative to `cmd`, but schedules the command to be executed at the end of this task instead of immediately. This cannot be used together with `cmd`. |
|
||||
|
||||
:::info
|
||||
|
||||
If given as a a string, the value will be assigned to `cmd`:
|
||||
|
||||
```yaml
|
||||
tasks:
|
||||
foo:
|
||||
cmds:
|
||||
- echo "foo"
|
||||
- echo "bar"
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Variable
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| - | - | - | - |
|
||||
| *itself* | `string` | | A static value that will be set to the variable. |
|
||||
| `sh` | `string` | | A shell command. The output (`STDOUT`) will be assigned to the variable. |
|
||||
|
||||
:::info
|
||||
|
||||
Static and dynamic variables have different syntaxes, like below:
|
||||
|
||||
```yaml
|
||||
vars:
|
||||
STATIC: static
|
||||
DYNAMIC:
|
||||
sh: echo "dynamic"
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### Precondition
|
||||
|
||||
| Attribute | Type | Default | Description |
|
||||
| - | - | - | - |
|
||||
| `sh` | `string` | | Command to be executed. If a non-zero exit code is returned, the task errors without executing its commands. |
|
||||
| `msg` | `string` | | Optional message to print if the precondition isn't met. |
|
||||
|
||||
:::tip
|
||||
|
||||
If you don't want to set a different message, you can declare a precondition
|
||||
like this and the value will be assigned to `sh`:
|
||||
|
||||
```yaml
|
||||
tasks:
|
||||
foo:
|
||||
precondition: test -f Taskfile.yml
|
||||
```
|
||||
|
||||
:::
|
||||
605
docs/docs/changelog.md
Normal file
605
docs/docs/changelog.md
Normal file
@@ -0,0 +1,605 @@
|
||||
---
|
||||
slug: /changelog/
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# Changelog
|
||||
|
||||
## v3.18.0
|
||||
|
||||
- Show aliases on `task --list --silent` (`task --ls`). This means that aliases
|
||||
will be completed by the completion scripts
|
||||
([#919](https://github.com/go-task/task/pull/919)).
|
||||
- Tasks in the root Taskfile will now be displayed first in `--list`/`--list-all`
|
||||
output ([#806](https://github.com/go-task/task/pull/806), [#890](https://github.com/go-task/task/pull/890)).
|
||||
- It's now possible to call a `default` task in an included Taskfile by using
|
||||
just the namespace. For example: `docs:default` is now automatically
|
||||
aliased to `docs`
|
||||
([#661](https://github.com/go-task/task/issues/661), [#815](https://github.com/go-task/task/pull/815)).
|
||||
|
||||
## v3.17.0
|
||||
|
||||
- Add a "Did you mean ...?" suggestion when a task does not exits another one
|
||||
with a similar name is found
|
||||
([#867](https://github.com/go-task/task/issues/867), [#880](https://github.com/go-task/task/pull/880)).
|
||||
- Now YAML parse errors will print which Taskfile failed to parse
|
||||
([#885](https://github.com/go-task/task/issues/885), [#887](https://github.com/go-task/task/pull/887)).
|
||||
- Add ability to set `aliases` for tasks and namespaces ([#268](https://github.com/go-task/task/pull/268), [#340](https://github.com/go-task/task/pull/340), [#879](https://github.com/go-task/task/pull/879)).
|
||||
- Improvements to Fish shell completion
|
||||
([#897](https://github.com/go-task/task/pull/897)).
|
||||
- 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`
|
||||
([#603](https://github.com/go-task/task/issues/603), [#877](https://github.com/go-task/task/pull/877)).
|
||||
|
||||
## v3.16.0 - 2022-09-29
|
||||
|
||||
- Add `npm` as new installation method: `npm i -g @go-task/cli`
|
||||
([#870](https://github.com/go-task/task/issues/870), [#871](https://github.com/go-task/task/pull/871), [npm package](https://www.npmjs.com/package/@go-task/cli)).
|
||||
- Add support to marking tasks and includes as internal, which will hide them
|
||||
from `--list` and `--list-all`
|
||||
([#818](https://github.com/go-task/task/pull/818)).
|
||||
|
||||
## v3.15.2 - 2022-09-08
|
||||
|
||||
- Fix error when using variable in `env:` introduced in the previous release
|
||||
([#858](https://github.com/go-task/task/issues/858), [#866](https://github.com/go-task/task/pull/866)).
|
||||
- Fix handling of `CLI_ARGS` (`--`) in Bash completion
|
||||
([#863](https://github.com/go-task/task/pull/863)).
|
||||
- On zsh completion, add ability to replace `--list-all` with `--list` as
|
||||
already possible on the Bash completion
|
||||
([#861](https://github.com/go-task/task/pull/861)).
|
||||
|
||||
## v3.15.0 - 2022-09-03
|
||||
|
||||
- Add new special variables `ROOT_DIR` and `TASKFILE_DIR`. This was a highly
|
||||
requested feature
|
||||
([#215](https://github.com/go-task/task/issues/215), [#857](https://github.com/go-task/task/pull/857), [Documentation](https://taskfile.dev/api/#special-variables)).
|
||||
- Follow symlinks on `sources`
|
||||
([#826](https://github.com/go-task/task/issues/826), [#831](https://github.com/go-task/task/pull/831)).
|
||||
- Improvements and fixes to Bash completion
|
||||
([#835](https://github.com/go-task/task/pull/835), [#844](https://github.com/go-task/task/pull/844)).
|
||||
|
||||
## v3.14.1 - 2022-08-03
|
||||
|
||||
- Always resolve relative include paths relative to the including Taskfile
|
||||
([#822](https://github.com/go-task/task/issues/822), [#823](https://github.com/go-task/task/pull/823)).
|
||||
- Fix ZSH and PowerShell completions to consider all tasks instead of just the
|
||||
public ones (those with descriptions)
|
||||
([#803](https://github.com/go-task/task/pull/803)).
|
||||
|
||||
## v3.14.0 - 2022-07-08
|
||||
|
||||
- Add ability to override the `.task` directory location with the
|
||||
`TASK_TEMP_DIR` environment variable.
|
||||
- Allow to override Task colors using environment variables:
|
||||
`TASK_COLOR_RESET`, `TASK_COLOR_BLUE`, `TASK_COLOR_GREEN`,
|
||||
`TASK_COLOR_CYAN`, `TASK_COLOR_YELLOW`, `TASK_COLOR_MAGENTA`
|
||||
and `TASK_COLOR_RED`
|
||||
([#568](https://github.com/go-task/task/pull/568), [#792](https://github.com/go-task/task/pull/792)).
|
||||
- Fixed bug when using the `output: group` mode where STDOUT and STDERR were
|
||||
being print in separated blocks instead of in the right order
|
||||
([#779](https://github.com/go-task/task/issues/779)).
|
||||
- Starting on this release, ARM architecture binaries are been released to Snap
|
||||
as well
|
||||
([#795](https://github.com/go-task/task/issues/795)).
|
||||
- i386 binaries won't be available anymore on Snap because Ubuntu removed the support
|
||||
for this architecture.
|
||||
- Upgrade mvdan.cc/sh, which fixes a bug with associative arrays
|
||||
([#785](https://github.com/go-task/task/issues/785), [mvdan/sh#884](https://github.com/mvdan/sh/issues/884), [mvdan/sh#893](https://github.com/mvdan/sh/pull/893)).
|
||||
|
||||
## v3.13.0 - 2022-06-13
|
||||
|
||||
- Added `-n` as an alias to `--dry`
|
||||
([#776](https://github.com/go-task/task/issues/776), [#777](https://github.com/go-task/task/pull/777)).
|
||||
- Fix behavior of interrupt (SIGINT, SIGTERM) signals. Task will now give time
|
||||
for the processes running to do cleanup work
|
||||
([#458](https://github.com/go-task/task/issues/458), [#479](https://github.com/go-task/task/pull/479), [#728](https://github.com/go-task/task/issues/728), [#769](https://github.com/go-task/task/pull/769)).
|
||||
- Add new `--exit-code` (`-x`) flag that will pass-through the exit form the
|
||||
command being ran
|
||||
([#755](https://github.com/go-task/task/pull/755)).
|
||||
|
||||
## v3.12.1 - 2022-05-10
|
||||
|
||||
- Fixed bug where, on Windows, variables were ending with `\r` because we were
|
||||
only removing the final `\n` but not `\r\n`
|
||||
([#717](https://github.com/go-task/task/issues/717)).
|
||||
|
||||
## v3.12.0 - 2022-03-31
|
||||
|
||||
- The `--list` and `--list-all` flags can now be combined with the `--silent`
|
||||
flag to print the task names only, without their description
|
||||
([#691](https://github.com/go-task/task/pull/691)).
|
||||
- Added support for multi-level inclusion of Taskfiles. This means that
|
||||
included Taskfiles can also include other Taskfiles. Before this was limited
|
||||
to one level
|
||||
([#390](https://github.com/go-task/task/issues/390), [#623](https://github.com/go-task/task/discussions/623), [#656](https://github.com/go-task/task/pull/656)).
|
||||
- Add ability to specify vars when including a Taskfile.
|
||||
[Check out the documentation](https://taskfile.dev/#/usage?id=vars-of-included-taskfiles)
|
||||
for more information.
|
||||
([#677](https://github.com/go-task/task/pull/677)).
|
||||
|
||||
## v3.11.0 - 2022-02-19
|
||||
|
||||
- Task now supports printing begin and end messages when using the `group`
|
||||
output mode, useful for grouping tasks in CI systems.
|
||||
[Check out the documentation](http://taskfile.dev/#/usage?id=output-syntax) for more information
|
||||
([#647](https://github.com/go-task/task/issues/647), [#651](https://github.com/go-task/task/pull/651)).
|
||||
- Add `Taskfile.dist.yml` and `Taskfile.dist.yaml` to the supported file
|
||||
name list. [Check out the documentation](https://taskfile.dev/#/usage?id=supported-file-names) for more information
|
||||
([#498](https://github.com/go-task/task/issues/498), [#666](https://github.com/go-task/task/pull/666)).
|
||||
|
||||
## v3.10.0 - 2022-01-04
|
||||
|
||||
- A new `--list-all` (alias `-a`) flag is now available. It's similar to the
|
||||
exiting `--list` (`-l`) but prints all tasks, even those without a
|
||||
description
|
||||
([#383](https://github.com/go-task/task/issues/383), [#401](https://github.com/go-task/task/pull/401)).
|
||||
- It's now possible to schedule cleanup commands to run once a task finishes
|
||||
with the `defer:` keyword
|
||||
([Documentation](https://taskfile.dev/#/usage?id=doing-task-cleanup-with-defer), [#475](https://github.com/go-task/task/issues/475), [#626](https://github.com/go-task/task/pull/626)).
|
||||
- Remove long deprecated and undocumented `$` variable prefix and `^` command
|
||||
prefix
|
||||
([#642](https://github.com/go-task/task/issues/642), [#644](https://github.com/go-task/task/issues/644), [#645](https://github.com/go-task/task/pull/645)).
|
||||
- Add support for `.yaml` extension (as an alternative to `.yml`).
|
||||
This was requested multiple times throughout the years. Enjoy!
|
||||
([#183](https://github.com/go-task/task/issues/183), [#184](https://github.com/go-task/task/pull/184), [#369](https://github.com/go-task/task/issues/369), [#584](https://github.com/go-task/task/issues/584), [#621](https://github.com/go-task/task/pull/621)).
|
||||
- Fixed error when computing a variable when the task directory do not exist
|
||||
yet
|
||||
([#481](https://github.com/go-task/task/issues/481), [#579](https://github.com/go-task/task/pull/579)).
|
||||
|
||||
## v3.9.2 - 2021-12-02
|
||||
|
||||
- Upgrade [mvdan/sh](https://github.com/mvdan/sh) which contains a fix a for
|
||||
a important regression on Windows
|
||||
([#619](https://github.com/go-task/task/issues/619), [mvdan/sh#768](https://github.com/mvdan/sh/issues/768), [mvdan/sh#769](https://github.com/mvdan/sh/pull/769)).
|
||||
|
||||
## v3.9.1 - 2021-11-28
|
||||
|
||||
- Add logging in verbose mode for when a task starts and finishes
|
||||
([#533](https://github.com/go-task/task/issues/533), [#588](https://github.com/go-task/task/pull/588)).
|
||||
- Fix an issue with preconditions and context errors
|
||||
([#597](https://github.com/go-task/task/issues/597), [#598](https://github.com/go-task/task/pull/598)).
|
||||
- Quote each `{{.CLI_ARGS}}` argument to prevent one with spaces to become many
|
||||
([#613](https://github.com/go-task/task/pull/613)).
|
||||
- Fix nil pointer when `cmd:` was left empty
|
||||
([#612](https://github.com/go-task/task/issues/612), [#614](https://github.com/go-task/task/pull/614)).
|
||||
- Upgrade [mvdan/sh](https://github.com/mvdan/sh) which contains two
|
||||
relevant fixes:
|
||||
- Fix quote of empty strings in `shellQuote`
|
||||
([#609](https://github.com/go-task/task/issues/609), [mvdan/sh#763](https://github.com/mvdan/sh/issues/763)).
|
||||
- Fix issue of wrong environment variable being picked when there's another
|
||||
very similar one
|
||||
([#586](https://github.com/go-task/task/issues/586), [mvdan/sh#745](https://github.com/mvdan/sh/pull/745)).
|
||||
- Install shell completions automatically when installing via Homebrew
|
||||
([#264](https://github.com/go-task/task/issues/264), [#592](https://github.com/go-task/task/pull/592), [go-task/homebrew-tap#2](https://github.com/go-task/homebrew-tap/pull/2)).
|
||||
|
||||
## v3.9.0 - 2021-10-02
|
||||
|
||||
- A new `shellQuote` function was added to the template system
|
||||
(`{{shellQuote "a string"}}`) to ensure a string is safe for use in shell
|
||||
([mvdan/sh#727](https://github.com/mvdan/sh/pull/727), [mvdan/sh#737](https://github.com/mvdan/sh/pull/737), [Documentation](https://pkg.go.dev/mvdan.cc/sh/v3@v3.4.0/syntax#Quote))
|
||||
- In this version [mvdan.cc/sh](https://github.com/mvdan/sh) was upgraded
|
||||
with some small fixes and features
|
||||
- The `read -p` flag is now supported
|
||||
([#314](https://github.com/go-task/task/issues/314), [mvdan/sh#551](https://github.com/mvdan/sh/issues/551), [mvdan/sh#772](https://github.com/mvdan/sh/pull/722))
|
||||
- The `pwd -P` and `pwd -L` flags are now supported
|
||||
([#553](https://github.com/go-task/task/issues/553), [mvdan/sh#724](https://github.com/mvdan/sh/issues/724), [mvdan/sh#728](https://github.com/mvdan/sh/pull/728))
|
||||
- The `$GID` environment variable is now correctly being set
|
||||
([#561](https://github.com/go-task/task/issues/561), [mvdan/sh#723](https://github.com/mvdan/sh/pull/723))
|
||||
|
||||
## v3.8.0 - 2021-09-26
|
||||
|
||||
- Add `interactive: true` setting to improve support for interactive CLI apps
|
||||
([#217](https://github.com/go-task/task/issues/217), [#563](https://github.com/go-task/task/pull/563)).
|
||||
- Fix some `nil` errors
|
||||
([#534](https://github.com/go-task/task/issues/534), [#573](https://github.com/go-task/task/pull/573)).
|
||||
- Add ability to declare an included Taskfile as optional
|
||||
([#519](https://github.com/go-task/task/issues/519), [#552](https://github.com/go-task/task/pull/552)).
|
||||
- Add support for including Taskfiles in the home directory by using `~`
|
||||
([#539](https://github.com/go-task/task/issues/539), [#557](https://github.com/go-task/task/pull/557)).
|
||||
|
||||
## v3.7.3 - 2021-09-04
|
||||
|
||||
- Add official support to Apple M1 ([#564](https://github.com/go-task/task/pull/564), [#567](https://github.com/go-task/task/pull/567)).
|
||||
- Our [official Homebrew tap](https://github.com/go-task/homebrew-tap) will
|
||||
support more platforms, including Apple M1
|
||||
|
||||
## v3.7.0 - 2021-07-31
|
||||
|
||||
- Add `run:` setting to control if tasks should run multiple times or not.
|
||||
Available options are `always` (the default), `when_changed` (if a variable
|
||||
modified the task) and `once` (run only once no matter what).
|
||||
This is a long time requested feature. Enjoy!
|
||||
([#53](https://github.com/go-task/task/issues/53), [#359](https://github.com/go-task/task/pull/359)).
|
||||
|
||||
## v3.6.0 - 2021-07-10
|
||||
|
||||
- Allow using both `sources:` and `status:` in the same task
|
||||
([#411](https://github.com/go-task/task/issues/411), [#427](https://github.com/go-task/task/issues/427), [#477](https://github.com/go-task/task/pull/477)).
|
||||
- Small optimization and bug fix: don't compute variables if not needed for
|
||||
`dotenv:` ([#517](https://github.com/go-task/task/issues/517)).
|
||||
|
||||
## v3.5.0 - 2021-07-04
|
||||
|
||||
- Add support for interpolation in `dotenv:`
|
||||
([#433](https://github.com/go-task/task/discussions/433), [#434](https://github.com/go-task/task/issues/434), [#453](https://github.com/go-task/task/pull/453)).
|
||||
|
||||
## 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
|
||||
|
||||
- Add support for delegating CLI arguments to commands with `--` and a
|
||||
special `CLI_ARGS` variable
|
||||
([#327](https://github.com/go-task/task/issues/327)).
|
||||
- Add a `--concurrency` (alias `-C`) flag, to limit the number of tasks that
|
||||
run concurrently. This is useful for heavy workloads.
|
||||
([#345](https://github.com/go-task/task/pull/345)).
|
||||
|
||||
## v3.2.2 - 2021-01-12
|
||||
|
||||
- Improve performance of `--list` and `--summary` by skipping running shell
|
||||
variables for these flags
|
||||
([#332](https://github.com/go-task/task/issues/332)).
|
||||
- Fixed a bug where an environment in a Taskfile was not always overridable
|
||||
by the system environment
|
||||
([#425](https://github.com/go-task/task/issues/425)).
|
||||
- Fixed environment from .env files not being available as variables
|
||||
([#379](https://github.com/go-task/task/issues/379)).
|
||||
- The install script is now working for ARM platforms
|
||||
([#428](https://github.com/go-task/task/pull/428)).
|
||||
|
||||
## v3.2.1 - 2021-01-09
|
||||
|
||||
- Fixed some bugs and regressions regarding dynamic variables and directories
|
||||
([#426](https://github.com/go-task/task/issues/426)).
|
||||
- The [slim-sprig](https://github.com/go-task/slim-sprig) package was updated
|
||||
with the upstream [sprig](https://github.com/Masterminds/sprig).
|
||||
|
||||
## v3.2.0 - 2021-01-07
|
||||
|
||||
- Fix the `.task` directory being created in the task directory instead of the
|
||||
Taskfile directory
|
||||
([#247](https://github.com/go-task/task/issues/247)).
|
||||
- Fix a bug where dynamic variables (those declared with `sh:`) were not
|
||||
running in the task directory when the task has a custom dir or it was
|
||||
in an included Taskfile
|
||||
([#384](https://github.com/go-task/task/issues/384)).
|
||||
- The watch feature (via the `--watch` flag) got a few different bug fixes and
|
||||
should be more stable now
|
||||
([#423](https://github.com/go-task/task/pull/423), [#365](https://github.com/go-task/task/issues/365)).
|
||||
|
||||
## v3.1.0 - 2021-01-03
|
||||
|
||||
- Fix a bug when the checksum up-to-date resolution is used by a task
|
||||
with a custom `label:` attribute
|
||||
([#412](https://github.com/go-task/task/issues/412)).
|
||||
- Starting from this release, we're releasing official ARMv6 and ARM64 binaries
|
||||
for Linux
|
||||
([#375](https://github.com/go-task/task/issues/375), [#418](https://github.com/go-task/task/issues/418)).
|
||||
- Task now respects the order of declaration of included Taskfiles when
|
||||
evaluating variables declaring by them
|
||||
([#393](https://github.com/go-task/task/issues/393)).
|
||||
- `set -e` is now automatically set on every command. This was done to fix an
|
||||
issue where multiline string commands wouldn't really fail unless the
|
||||
sentence was in the last line
|
||||
([#403](https://github.com/go-task/task/issues/403)).
|
||||
|
||||
## v3.0.1 - 2020-12-26
|
||||
|
||||
- Allow use as a library by moving the required packages out of the `internal`
|
||||
directory
|
||||
([#358](https://github.com/go-task/task/pull/358)).
|
||||
- Do not error if a specified dotenv file does not exist
|
||||
([#378](https://github.com/go-task/task/issues/378), [#385](https://github.com/go-task/task/pull/385)).
|
||||
- Fix panic when you have empty tasks in your Taskfile
|
||||
([#338](https://github.com/go-task/task/issues/338), [#362](https://github.com/go-task/task/pull/362)).
|
||||
|
||||
## v3.0.0 - 2020-08-16
|
||||
|
||||
- On `v3`, all CLI variables will be considered global variables
|
||||
([#336](https://github.com/go-task/task/issues/336), [#341](https://github.com/go-task/task/pull/341))
|
||||
- Add support to `.env` like files
|
||||
([#324](https://github.com/go-task/task/issues/324), [#356](https://github.com/go-task/task/pull/356)).
|
||||
- Add `label:` to task so you can override the task name in the logs
|
||||
([#321](https://github.com/go-task/task/issues/321]), [#337](https://github.com/go-task/task/pull/337)).
|
||||
- Refactor how variables work on version 3
|
||||
([#311](https://github.com/go-task/task/pull/311)).
|
||||
- Disallow `expansions` on v3 since it has no effect.
|
||||
- `Taskvars.yml` is not automatically included anymore.
|
||||
- `Taskfile_{{OS}}.yml` is not automatically included anymore.
|
||||
- Allow interpolation on `includes`, so you can manually include a Taskfile
|
||||
based on operation system, for example.
|
||||
- Expose `.TASK` variable in templates with the task name
|
||||
([#252](https://github.com/go-task/task/issues/252)).
|
||||
- Implement short task syntax
|
||||
([#194](https://github.com/go-task/task/issues/194), [#240](https://github.com/go-task/task/pull/240)).
|
||||
- Added option to make included Taskfile run commands on its own directory
|
||||
([#260](https://github.com/go-task/task/issues/260), [#144](https://github.com/go-task/task/issues/144))
|
||||
- Taskfiles in version 1 are not supported anymore
|
||||
([#237](https://github.com/go-task/task/pull/237)).
|
||||
- Added global `method:` option. With this option, you can set a default
|
||||
method to all tasks in a Taskfile
|
||||
([#246](https://github.com/go-task/task/issues/246)).
|
||||
- Changed default method from `timestamp` to `checksum`
|
||||
([#246](https://github.com/go-task/task/issues/246)).
|
||||
- New magic variables are now available when using `status:`:
|
||||
`.TIMESTAMP` which contains the greatest modification date
|
||||
from the files listed in `sources:`, and `.CHECKSUM`, which
|
||||
contains a checksum of all files listed in `status:`.
|
||||
This is useful for manual checking when using external, or even remote,
|
||||
artifacts when using `status:`
|
||||
([#216](https://github.com/go-task/task/pull/216)).
|
||||
- We're now using [slim-sprig](https://github.com/go-task/slim-sprig) instead of
|
||||
[sprig](https://github.com/Masterminds/sprig), which allowed a file size
|
||||
reduction of about 22%
|
||||
([#219](https://github.com/go-task/task/pull/219)).
|
||||
- We now use some colors on Task output to better distinguish message types -
|
||||
commands are green, errors are red, etc
|
||||
([#207](https://github.com/go-task/task/pull/207)).
|
||||
|
||||
## v2.8.1 - 2020-05-20
|
||||
|
||||
- Fix error code for the `--help` flag
|
||||
([#300](https://github.com/go-task/task/issues/300), [#330](https://github.com/go-task/task/pull/330)).
|
||||
- Print version to stdout instead of stderr
|
||||
([#299](https://github.com/go-task/task/issues/299), [#329](https://github.com/go-task/task/pull/329)).
|
||||
- Supress `context` errors when using the `--watch` flag
|
||||
([#313](https://github.com/go-task/task/issues/313), [#317](https://github.com/go-task/task/pull/317)).
|
||||
- Support templating on description
|
||||
([#276](https://github.com/go-task/task/issues/276), [#283](https://github.com/go-task/task/pull/283)).
|
||||
|
||||
## v2.8.0 - 2019-12-07
|
||||
|
||||
- Add `--parallel` flag (alias `-p`) to run tasks given by the command line in
|
||||
parallel
|
||||
([#266](https://github.com/go-task/task/pull/266)).
|
||||
- Fixed bug where calling the `task` CLI only informing global vars would not
|
||||
execute the `default` task.
|
||||
- Add hability to silent all tasks by adding `silent: true` a the root of the
|
||||
Taskfile.
|
||||
|
||||
## v2.7.1 - 2019-11-10
|
||||
|
||||
- Fix error being raised when `exit 0` was called
|
||||
([#251](https://github.com/go-task/task/issues/251)).
|
||||
|
||||
## v2.7.0 - 2019-09-22
|
||||
|
||||
- Fixed panic bug when assigning a global variable
|
||||
([#229](https://github.com/go-task/task/issues/229), [#243](https://github.com/go-task/task/issues/234)).
|
||||
- A task with `method: checksum` will now re-run if generated files are deleted
|
||||
([#228](https://github.com/go-task/task/pull/228), [#238](https://github.com/go-task/task/issues/238)).
|
||||
|
||||
## v2.6.0 - 2019-07-21
|
||||
|
||||
- Fixed some bugs regarding minor version checks on `version:`.
|
||||
- Add `preconditions:` to task
|
||||
([#205](https://github.com/go-task/task/pull/205)).
|
||||
- Create directory informed on `dir:` if it doesn't exist
|
||||
([#209](https://github.com/go-task/task/issues/209), [#211](https://github.com/go-task/task/pull/211)).
|
||||
- We now have a `--taskfile` flag (alias `-t`), which can be used to run
|
||||
another Taskfile (other than the default `Taskfile.yml`)
|
||||
([#221](https://github.com/go-task/task/pull/221)).
|
||||
- It's now possible to install Task using Homebrew on Linux
|
||||
([go-task/homebrew-tap#1](https://github.com/go-task/homebrew-tap/pull/1)).
|
||||
|
||||
## v2.5.2 - 2019-05-11
|
||||
|
||||
- Reverted YAML upgrade due issues with CRLF on Windows
|
||||
([#201](https://github.com/go-task/task/issues/201), [go-yaml/yaml#450](https://github.com/go-yaml/yaml/issues/450)).
|
||||
- Allow setting global variables through the CLI
|
||||
([#192](https://github.com/go-task/task/issues/192)).
|
||||
|
||||
## 2.5.1 - 2019-04-27
|
||||
|
||||
- Fixed some issues with interactive command line tools, where sometimes
|
||||
the output were not being shown, and similar issues
|
||||
([#114](https://github.com/go-task/task/issues/114), [#190](https://github.com/go-task/task/issues/190), [#200](https://github.com/go-task/task/pull/200)).
|
||||
- Upgraded [go-yaml/yaml](https://github.com/go-yaml/yaml) from v2 to v3.
|
||||
|
||||
## v2.5.0 - 2019-03-16
|
||||
|
||||
- We moved from the taskfile.org domain to the new fancy taskfile.dev domain.
|
||||
While stuff is being redirected, we strongly recommend to everyone that use
|
||||
[this install script](https://taskfile.dev/#/installation?id=install-script)
|
||||
to use the new taskfile.dev domain on scripts from now on.
|
||||
- Fixed to the ZSH completion
|
||||
([#182](https://github.com/go-task/task/pull/182)).
|
||||
- Add [`--summary` flag along with `summary:` task attribute](https://taskfile.org/#/usage?id=display-summary-of-task)
|
||||
([#180](https://github.com/go-task/task/pull/180)).
|
||||
|
||||
## v2.4.0 - 2019-02-21
|
||||
|
||||
- Allow calling a task of the root Taskfile from an included Taskfile
|
||||
by prefixing it with `:`
|
||||
([#161](https://github.com/go-task/task/issues/161), [#172](https://github.com/go-task/task/issues/172)),
|
||||
- Add flag to override the `output` option
|
||||
([#173](https://github.com/go-task/task/pull/173));
|
||||
- Fix bug where Task was persisting the new checksum on the disk when the Dry
|
||||
Mode is enabled
|
||||
([#166](https://github.com/go-task/task/issues/166));
|
||||
- Fix file timestamp issue when the file name has spaces
|
||||
([#176](https://github.com/go-task/task/issues/176));
|
||||
- Mitigating path expanding issues on Windows
|
||||
([#170](https://github.com/go-task/task/pull/170)).
|
||||
|
||||
## v2.3.0 - 2019-01-02
|
||||
|
||||
- On Windows, Task can now be installed using [Scoop](https://scoop.sh/)
|
||||
([#152](https://github.com/go-task/task/pull/152));
|
||||
- Fixed issue with file/directory globing
|
||||
([#153](https://github.com/go-task/task/issues/153));
|
||||
- Added ability to globally set environment variables
|
||||
(
|
||||
[#138](https://github.com/go-task/task/pull/138),
|
||||
[#159](https://github.com/go-task/task/pull/159)
|
||||
).
|
||||
|
||||
## v2.2.1 - 2018-12-09
|
||||
|
||||
- This repository now uses Go Modules (#143). We'll still keep the `vendor` directory in sync for some time, though;
|
||||
- Fixing a bug when the Taskfile has no tasks but includes another Taskfile (#150);
|
||||
- Fix a bug when calling another task or a dependency in an included Taskfile (#151).
|
||||
|
||||
## v2.2.0 - 2018-10-25
|
||||
|
||||
- Added support for [including other Taskfiles](https://taskfile.org/#/usage?id=including-other-taskfiles) (#98)
|
||||
- This should be considered experimental. For now, only including local files is supported, but support for including remote Taskfiles is being discussed. If you have any feedback, please comment on #98.
|
||||
- Task now have a dedicated documentation site: https://taskfile.org
|
||||
- Thanks to [Docsify](https://docsify.js.org/) for making this pretty easy. To check the source code, just take a look at the [docs](https://github.com/go-task/task/tree/master/docs) directory of this repository. Contributions to the documentation is really appreciated.
|
||||
|
||||
## v2.1.1 - 2018-09-17
|
||||
|
||||
- Fix suggestion to use `task --init` not being shown anymore (when a `Taskfile.yml` is not found)
|
||||
- Fix error when using checksum method and no file exists for a source glob (#131)
|
||||
- Fix signal handling when the `--watch` flag is given (#132)
|
||||
|
||||
## v2.1.0 - 2018-08-19
|
||||
|
||||
- Add a `ignore_error` option to task and command (#123)
|
||||
- Add a dry run mode (`--dry` flag) (#126)
|
||||
|
||||
## v2.0.3 - 2018-06-24
|
||||
|
||||
- Expand environment variables on "dir", "sources" and "generates" (#116)
|
||||
- Fix YAML merging syntax (#112)
|
||||
- Add ZSH completion (#111)
|
||||
- Implement new `output` option. Please check out the [documentation](https://github.com/go-task/task#output-syntax)
|
||||
|
||||
## v2.0.2 - 2018-05-01
|
||||
|
||||
- Fix merging of YAML anchors (#112)
|
||||
|
||||
## v2.0.1 - 2018-03-11
|
||||
|
||||
- Fixes panic on `task --list`
|
||||
|
||||
## v2.0.0 - 2018-03-08
|
||||
|
||||
Version 2.0.0 is here, with a new Taskfile format.
|
||||
|
||||
Please, make sure to read the [Taskfile versions](https://github.com/go-task/task/blob/master/TASKFILE_VERSIONS.md) document, since it describes in depth what changed for this version.
|
||||
|
||||
* New Taskfile version 2 (https://github.com/go-task/task/issues/77)
|
||||
* Possibility to have global variables in the `Taskfile.yml` instead of `Taskvars.yml` (https://github.com/go-task/task/issues/66)
|
||||
* Small improvements and fixes
|
||||
|
||||
## v1.4.4 - 2017-11-19
|
||||
|
||||
- Handle SIGINT and SIGTERM (#75);
|
||||
- List: print message with there's no task with description;
|
||||
- Expand home dir ("~" symbol) on paths (#74);
|
||||
- Add Snap as an installation method;
|
||||
- Move examples to its own repo;
|
||||
- Watch: also walk on tasks called on on "cmds", and not only on "deps";
|
||||
- Print logs to stderr instead of stdout (#68);
|
||||
- Remove deprecated `set` keyword;
|
||||
- Add checksum based status check, alternative to timestamp based.
|
||||
|
||||
## v1.4.3 - 2017-09-07
|
||||
|
||||
- Allow assigning variables to tasks at run time via CLI (#33)
|
||||
- Added suport for multiline variables from sh (#64)
|
||||
- Fixes env: remove square braces and evaluate shell (#62)
|
||||
- Watch: change watch library and few fixes and improvements
|
||||
- When use watching, cancel and restart long running process on file change (#59 and #60)
|
||||
|
||||
## v1.4.2 - 2017-07-30
|
||||
|
||||
- Flag to set directory of execution
|
||||
- Always echo command if is verbose mode
|
||||
- Add silent mode to disable echoing of commands
|
||||
- Fixes and improvements of variables (#56)
|
||||
|
||||
## v1.4.1 - 2017-07-15
|
||||
|
||||
- Allow use of YAML for dynamic variables instead of $ prefix
|
||||
- `VAR: {sh: echo Hello}` instead of `VAR: $echo Hello`
|
||||
- Add `--list` (or `-l`) flag to print existing tasks
|
||||
- OS specific Taskvars file (e.g. `Taskvars_windows.yml`, `Taskvars_linux.yml`, etc)
|
||||
- Consider task up-to-date on equal timestamps (#49)
|
||||
- Allow absolute path in generates section (#48)
|
||||
- Bugfix: allow templating when calling deps (#42)
|
||||
- Fix panic for invalid task in cyclic dep detection
|
||||
- Better error output for dynamic variables in Taskvars.yml (#41)
|
||||
- Allow template evaluation in parameters
|
||||
|
||||
## v1.4.0 - 2017-07-06
|
||||
|
||||
- Cache dynamic variables
|
||||
- Add verbose mode (`-v` flag)
|
||||
- Support to task parameters (overriding vars) (#31) (#32)
|
||||
- Print command, also when "set:" is specified (#35)
|
||||
- Improve task command help text (#35)
|
||||
|
||||
## v1.3.1 - 2017-06-14
|
||||
|
||||
- Fix glob not working on commands (#28)
|
||||
- Add ExeExt template function
|
||||
- Add `--init` flag to create a new Taskfile
|
||||
- Add status option to prevent task from running (#27)
|
||||
- Allow interpolation on `generates` and `sources` attributes (#26)
|
||||
|
||||
## v1.3.0 - 2017-04-24
|
||||
|
||||
- Migrate from os/exec.Cmd to a native Go sh/bash interpreter
|
||||
- This is a potentially breaking change if you use Windows.
|
||||
- Now, `cmd` is not used anymore on Windows. Always use Bash-like syntax for your commands, even on Windows.
|
||||
- Add "ToSlash" and "FromSlash" to template functions
|
||||
- Use functions defined on github.com/Masterminds/sprig
|
||||
- Do not redirect stdin while running variables commands
|
||||
- Using `context` and `errgroup` packages (this will make other tasks to be cancelled, if one returned an error)
|
||||
|
||||
## v1.2.0 - 2017-04-02
|
||||
|
||||
- More tests and Travis integration
|
||||
- Watch a task (experimental)
|
||||
- Possibility to call another task
|
||||
- Fix "=" not being reconized in variables/environment variables
|
||||
- Tasks can now have a description, and help will print them (#10)
|
||||
- Task dependencies now run concurrently
|
||||
- Support for a default task (#16)
|
||||
|
||||
## v1.1.0 - 2017-03-08
|
||||
|
||||
- Support for YAML, TOML and JSON (#1)
|
||||
- Support running command in another directory (#4)
|
||||
- `--force` or `-f` flag to force execution of task even when it's up-to-date
|
||||
- Detection of cyclic dependencies (#5)
|
||||
- Support for variables (#6, #9, #14)
|
||||
- Operation System specific commands and variables (#13)
|
||||
|
||||
## v1.0.0 - 2017-02-28
|
||||
|
||||
- Add LICENSE file
|
||||
63
docs/docs/community.md
Normal file
63
docs/docs/community.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
slug: /community/
|
||||
sidebar_position: 6
|
||||
---
|
||||
|
||||
# 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).
|
||||
|
||||
### Sublime Text 4 package
|
||||
|
||||
There is a convenience wrapper for initializing and running tasks from Sublime Text's command palette. The package is
|
||||
developed by [@biozz](https://github.com/biozz), the source code is available [here](https://github.com/biozz/sublime-taskfile)
|
||||
and it is published on Package Control [here](https://packagecontrol.io/packages/Taskfile).
|
||||
|
||||
### IntelliJ plugin
|
||||
|
||||
There's a JetBrains IntelliJ plugin done by
|
||||
[@lechuckroh](https://github.com/lechuckroh), which has its code [here](https://github.com/lechuckroh/task-intellij-plugin)
|
||||
and is published [here](https://plugins.jetbrains.com/plugin/17058-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/go-task-bin)
|
||||
by [@carlsmedstad](https://github.com/carlsmedstad)
|
||||
- [Scoop](https://github.com/lukesampson/scoop-extras/blob/master/bucket/task.json)
|
||||
- [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
||||
- [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/go-task/default.nix)
|
||||
|
||||
## 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.
|
||||
124
docs/docs/contributing.md
Normal file
124
docs/docs/contributing.md
Normal file
@@ -0,0 +1,124 @@
|
||||
---
|
||||
slug: /contributing/
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
# Contributing
|
||||
|
||||
Contributions to Task are very welcome, but we ask that you read this document
|
||||
before submitting a PR.
|
||||
|
||||
## Before you start
|
||||
|
||||
- **Check existing work** - Is there an existing PR? Are there issues discussing
|
||||
the feature/change you want to make? Please make sure you consider/address these
|
||||
discussions in your work.
|
||||
- **Backwards compatibility** - Will your change break existing Taskfiles? It is
|
||||
much more likely that your change will merged if it backwards compatible. Is
|
||||
there an approach you can take that maintains this compatibility? If not,
|
||||
consider opening an issue first so that API changes can be discussed before you
|
||||
invest you time into a PR.
|
||||
|
||||
## 1. Setup
|
||||
|
||||
- **Go** - Task is written in [Go]. We always support the latest two major Go
|
||||
versions, so make sure your version is recent enough.
|
||||
- **Node.js** - [Node.js] is used to host Task's documentation server and is
|
||||
required if you want to run this server locally.
|
||||
- **Yarn** - [Yarn] is the Node.js package manager used by Task.
|
||||
|
||||
## 2. Making changes
|
||||
|
||||
- **Code style** - Try to maintain the existing code style where possible and
|
||||
ensure that code is formatted by `gofmt`. We use `golangci-lint` in our CI to
|
||||
enforce a consistent style and best-practise. There's a `lint` command in
|
||||
the Taskfile to run this locally.
|
||||
- **Documentation** - Ensure that you add/update any relevant documentation. See
|
||||
the [updating documentation](#updating-documentation) section below.
|
||||
- **Tests** - Ensure that you add/update any relevant tests and that all tests
|
||||
are passing before submitting the PR. See the [writing tests](#writing-tests)
|
||||
section below.
|
||||
|
||||
### Running your changes
|
||||
|
||||
To run Task with working changes, you can use `go run ./cmd/task`. To run a
|
||||
development build of task against a test Taskfile in `testdata`, you can use `go
|
||||
run ./cmd/task --dir ./testdata/<my_test_dir> <task_name>`.
|
||||
|
||||
### Updating documentation
|
||||
|
||||
Task uses [Docusaurus] to host a documentation server. This can be setup and run
|
||||
locally by using `task docs:setup` and `task docs:start` respectively (requires
|
||||
`nodejs` & `yarn`). All content is written in Markdown and is located in the
|
||||
`docs/docs` directory. All Markdown documents should have an 80 character line
|
||||
wrap limit.
|
||||
|
||||
When making a change, consider whether a change to the [Usage Guide](./usage.md)
|
||||
is necessary. This document contains descriptions and examples of how to use
|
||||
Task features. If you're adding a new feature, try to find an appropriate place
|
||||
to add a new section. If you're updating an existing feature, ensure that the
|
||||
documentation and any examples are up-to-date. Ensure that any examples follow
|
||||
the [Taskfile Styleguide](./styleguide.md).
|
||||
|
||||
If you added a new field, command or flag, ensure that you add it to the [API
|
||||
Reference](./api_reference.md). New fields also need to be added to the
|
||||
[JSON Schema](../static/schema.json). The descriptions for fields in the API
|
||||
reference and the schema should match.
|
||||
|
||||
### Writing tests
|
||||
|
||||
Most of Task's test are held in the `task_test.go` file in the project root and
|
||||
this is where you'll most likely want to add new ones too. Most of these tests
|
||||
also have a subdirectory in the `testdata` directory where any Taskfiles/data
|
||||
required to run the tests are stored.
|
||||
|
||||
When making a changes, consider whether new tests are required. These tests
|
||||
should ensure that the functionality you are adding will continue to work in the
|
||||
future. Existing tests may also need updating if you have changed Task's
|
||||
behaviour.
|
||||
|
||||
## 3. Committing your code
|
||||
|
||||
Try to write meaningful commit messages and avoid having too many commits on
|
||||
the PR. Most PRs should likely have a single commit (although for bigger PRs it
|
||||
may be reasonable to split it in a few). Git squash and rebase is your friend!
|
||||
|
||||
## 4. Submitting a PR
|
||||
|
||||
- **Describe your changes** - Ensure that you provide a comprehensive
|
||||
description of your changes.
|
||||
- **Issue/PR links** - Link any previous work such as related issues or PRs.
|
||||
Please describe how your changes differ to/extend this work.
|
||||
- **Examples** - Add any examples that you think are useful to demonstrate the
|
||||
effect of your changes.
|
||||
- **Draft PRs** - If your changes are incomplete, but you would like to discuss
|
||||
them, open the PR as a draft and add a comment to start a discussion. Using
|
||||
comments rather than the PR description allows the description to be updated
|
||||
later while preserving any discussions.
|
||||
|
||||
## FAQ
|
||||
|
||||
> I want to contribute, where do I start?
|
||||
|
||||
Take a look at the list of [open issues]. We have a [good first issue] label for
|
||||
simpler issues that are ideal for first time contributions.
|
||||
|
||||
All kinds of contributions are welcome, whether its a typo fix or a shiny new
|
||||
feature. You can also contribute by upvoting/commenting on issues, helping to
|
||||
answer questions or contributing to other [community projects](./community.md).
|
||||
|
||||
> I'm stuck, where can I get help?
|
||||
|
||||
If you have questions, feel free to ask them in the `#help` channel on our
|
||||
[Discord server].
|
||||
|
||||
---
|
||||
|
||||
[Go]: https://go.dev
|
||||
[install version 1.18+]: https://go.dev/doc/install
|
||||
[Node.js]: https://nodejs.org/en/
|
||||
[Yarn]: https://yarnpkg.com/
|
||||
[Docusaurus]: https://docusaurus.io
|
||||
[open issues]: https://github.com/go-task/task/issues
|
||||
[good first issue]: https://github.com/go-task/task/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
|
||||
[Discord server]: https://discord.gg/6TY36E39UK
|
||||
36
docs/docs/donate.md
Normal file
36
docs/docs/donate.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
slug: /donate/
|
||||
sidebar_position: 10
|
||||
---
|
||||
|
||||
# Donate
|
||||
|
||||
If you find this project useful, you can consider donating by using one of the
|
||||
channels listed below.
|
||||
|
||||
This is just a way of saying "thank you", it won't give you any benefits like
|
||||
higher priority on issues or something similar.
|
||||
|
||||
## Open Collective
|
||||
|
||||
Task is on [Open Collective](https://opencollective.com/task) and you have
|
||||
these options to donate:
|
||||
|
||||
- [$2 per month](https://opencollective.com/task/contribute/backer-4034/checkout)
|
||||
- [$5 per month](https://opencollective.com/task/contribute/supporter-8404/checkout)
|
||||
- [$20 per month](https://opencollective.com/task/contribute/sponsor-4035/checkout)
|
||||
- [$50 per month](https://opencollective.com/task/contribute/sponsor-28775/checkout)
|
||||
- [Custom value - One-time donation option supported](https://opencollective.com/task/donate)
|
||||
|
||||
## GitHub Sponsors
|
||||
|
||||
- [@andreynering](https://github.com/sponsors/andreynering)
|
||||
|
||||
## PayPal
|
||||
|
||||
- [Any value - One-time donation](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=GSVDU63RKG45A¤cy_code=USD&source=url)
|
||||
|
||||
## PIX (Brazil only)
|
||||
|
||||
If you're Brazilian, you can donate any value by
|
||||
[using this QR Code](/img/pix.png).
|
||||
261
docs/docs/installation.md
Normal file
261
docs/docs/installation.md
Normal file
@@ -0,0 +1,261 @@
|
||||
---
|
||||
slug: /installation/
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
# Installation
|
||||
|
||||
Task offers many installation methods. Check out the available methods below.
|
||||
|
||||
## Package Managers
|
||||
|
||||
### Homebrew
|
||||
|
||||
If you're on macOS or Linux and have [Homebrew][homebrew] installed, getting
|
||||
Task is as simple as running:
|
||||
|
||||
```bash
|
||||
brew install go-task/tap/go-task
|
||||
```
|
||||
|
||||
### Snap
|
||||
|
||||
Task is available in [Snapcraft][snapcraft], but keep in mind that your
|
||||
Linux distribution should allow classic confinement for Snaps to Task work
|
||||
right:
|
||||
|
||||
```bash
|
||||
sudo snap install task --classic
|
||||
```
|
||||
|
||||
### Chocolatey
|
||||
|
||||
If you're on Windows and have [Chocolatey][choco] installed, getting
|
||||
Task is as simple as running:
|
||||
|
||||
```bash
|
||||
choco install go-task
|
||||
```
|
||||
|
||||
This installation method is community owned.
|
||||
|
||||
### Scoop
|
||||
|
||||
If you're on Windows and have [Scoop][scoop] installed, getting
|
||||
Task is as simple as running:
|
||||
|
||||
```cmd
|
||||
scoop install task
|
||||
```
|
||||
|
||||
This installation method is community owned. After a new release of Task, it
|
||||
may take some time until it's available on Scoop.
|
||||
|
||||
### AUR
|
||||
|
||||
If you're on Arch Linux you can install Task from
|
||||
[AUR](https://aur.archlinux.org/packages/go-task-bin) using your favorite
|
||||
package manager such as `yay`, `pacaur` or `yaourt`:
|
||||
|
||||
```cmd
|
||||
yay -S go-task-bin
|
||||
```
|
||||
|
||||
Alternatively, there's
|
||||
[this package](https://aur.archlinux.org/packages/go-task) which installs from
|
||||
the source code instead of downloading the binary from the
|
||||
[releases page](https://github.com/go-task/task/releases):
|
||||
|
||||
```cmd
|
||||
yay -S go-task
|
||||
```
|
||||
|
||||
This installation method is community owned.
|
||||
|
||||
### Fedora
|
||||
|
||||
If you're on Fedora Linux you can install Task from the official
|
||||
[Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/) repository using `dnf`:
|
||||
|
||||
```cmd
|
||||
sudo dnf install go-task
|
||||
```
|
||||
|
||||
This installation method is community owned. After a new release of Task, it
|
||||
may take some time until it's available in [Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/).
|
||||
|
||||
### Nix
|
||||
|
||||
If you're on NixOS or have Nix installed
|
||||
you can install Task from [nixpkgs](https://github.com/NixOS/nixpkgs):
|
||||
|
||||
```cmd
|
||||
nix-env -iA nixpkgs.go-task
|
||||
```
|
||||
|
||||
This installation method is community owned. After a new release of Task, it
|
||||
may take some time until it's available in [nixpkgs](https://github.com/NixOS/nixpkgs).
|
||||
|
||||
### npm
|
||||
|
||||
You can also use Node and npm to install Task by installing
|
||||
[this package](https://www.npmjs.com/package/@go-task/cli).
|
||||
|
||||
```bash
|
||||
npm install -g @go-task/cli
|
||||
```
|
||||
|
||||
## Get The Binary
|
||||
|
||||
### Binary
|
||||
|
||||
You can download the binary from the [releases page on GitHub][releases] and
|
||||
add to your `$PATH`.
|
||||
|
||||
DEB and RPM packages are also available.
|
||||
|
||||
The `task_checksums.txt` file contains the SHA-256 checksum for each file.
|
||||
|
||||
### Install Script
|
||||
|
||||
We also have an [install script][installscript] which is very useful in
|
||||
scenarios like CI. Many thanks to [GoDownloader][godownloader] for enabling the
|
||||
easy generation of this script.
|
||||
|
||||
By default, it installs on the `./bin` directory relative to the working
|
||||
directory:
|
||||
|
||||
```bash
|
||||
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
|
||||
```
|
||||
|
||||
It is possible to override the installation directory with the `-b` parameter.
|
||||
On Linux, common choices are `~/.local/bin` and `~/bin` to install for the
|
||||
current user or `/usr/local/bin` to install for all users:
|
||||
|
||||
```bash
|
||||
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
|
||||
```
|
||||
|
||||
:::caution
|
||||
|
||||
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by
|
||||
default.
|
||||
|
||||
:::
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
If you want to install Task in GitHub Actions you can try using
|
||||
[this action](https://github.com/arduino/setup-task)
|
||||
by the Arduino team:
|
||||
|
||||
```yaml
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
```
|
||||
|
||||
This installation method is community owned.
|
||||
|
||||
## Build From Source
|
||||
|
||||
### Go Modules
|
||||
|
||||
First, make sure you have [Go][go] properly installed and setup.
|
||||
|
||||
You can easily install the latest release globally by running:
|
||||
|
||||
```bash
|
||||
go install github.com/go-task/task/v3/cmd/task@latest
|
||||
```
|
||||
|
||||
Or you can install into another directory:
|
||||
|
||||
```bash
|
||||
env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
|
||||
```
|
||||
|
||||
If using Go 1.15 or earlier, instead use:
|
||||
|
||||
```bash
|
||||
env GO111MODULE=on go get -u github.com/go-task/task/v3/cmd/task@latest
|
||||
```
|
||||
|
||||
:::tip
|
||||
|
||||
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
|
||||
released binary.
|
||||
|
||||
:::
|
||||
|
||||
## Setup completions
|
||||
|
||||
Download the autocompletion file corresponding to your shell.
|
||||
|
||||
[All completions are available on the Task repository](https://github.com/go-task/task/tree/master/completion).
|
||||
|
||||
### Bash
|
||||
|
||||
First, ensure that you installed bash-completion using your package manager.
|
||||
|
||||
Make the completion file executable:
|
||||
|
||||
```
|
||||
chmod +x path/to/task.bash
|
||||
```
|
||||
|
||||
After, add this to your `~/.bash_profile`:
|
||||
|
||||
```shell
|
||||
source path/to/task.bash
|
||||
```
|
||||
|
||||
### ZSH
|
||||
|
||||
Put the `_task` file somewhere in your `$FPATH`:
|
||||
|
||||
```shell
|
||||
mv path/to/_task /usr/local/share/zsh/site-functions/_task
|
||||
```
|
||||
|
||||
Ensure that the following is present in your `~/.zshrc`:
|
||||
|
||||
```shell
|
||||
autoload -U compinit
|
||||
compinit -i
|
||||
```
|
||||
|
||||
ZSH version 5.7 or later is recommended.
|
||||
|
||||
### Fish
|
||||
|
||||
Move the `task.fish` completion script:
|
||||
|
||||
```shell
|
||||
mv path/to/task.fish ~/.config/fish/completions/task.fish
|
||||
```
|
||||
|
||||
### PowerShell
|
||||
|
||||
Open your profile script with:
|
||||
|
||||
```
|
||||
mkdir -Path (Split-Path -Parent $profile) -ErrorAction SilentlyContinue
|
||||
notepad $profile
|
||||
```
|
||||
|
||||
Add the line and save the file:
|
||||
|
||||
```shell
|
||||
Invoke-Expression -Command path/to/task.ps1
|
||||
```
|
||||
|
||||
[go]: https://golang.org/
|
||||
[snapcraft]: https://snapcraft.io/task
|
||||
[homebrew]: https://brew.sh/
|
||||
[installscript]: https://github.com/go-task/task/blob/master/install-task.sh
|
||||
[releases]: https://github.com/go-task/task/releases
|
||||
[godownloader]: https://github.com/goreleaser/godownloader
|
||||
[choco]: https://chocolatey.org/
|
||||
[scoop]: https://scoop.sh/
|
||||
57
docs/docs/intro.md
Normal file
57
docs/docs/intro.md
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
slug: /
|
||||
sidebar_position: 1
|
||||
title: Home
|
||||
---
|
||||
|
||||
# Task
|
||||
|
||||
<div align="center">
|
||||
<img id="logo" src="img/logo.svg" height="250px" width="250px" />
|
||||
</div>
|
||||
|
||||
Task is a task runner / build tool that aims to be simpler and easier to use
|
||||
than, for example, [GNU Make][make].
|
||||
|
||||
Since it's written in [Go][go], Task is just a single binary and has no other
|
||||
dependencies, which means you don't need to mess with any complicated install
|
||||
setups just to use a build tool.
|
||||
|
||||
Once [installed](installation.md), you just need to describe your build tasks
|
||||
using a simple [YAML][yaml] schema in a file called `Taskfile.yml`:
|
||||
|
||||
```yaml title="Taskfile.yml"
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
hello:
|
||||
cmds:
|
||||
- echo 'Hello World from Task!'
|
||||
silent: true
|
||||
```
|
||||
|
||||
And call it by running `task hello` from your terminal.
|
||||
|
||||
The above example is just the start, you can take a look at the [usage](/usage)
|
||||
guide to check the full schema documentation and Task features.
|
||||
|
||||
## Features
|
||||
|
||||
- [Easy installation](installation.md): just download a single binary, add to
|
||||
`$PATH` and you're done! Or you can also install using [Homebrew][homebrew],
|
||||
[Snapcraft][snapcraft], or [Scoop][scoop] if you want.
|
||||
- Available on CIs: by adding [this simple command](installation.md#install-script)
|
||||
to install on your CI script and you're ready to use Task as part of your CI pipeline;
|
||||
- Truly cross-platform: while most build tools only work well on Linux or macOS,
|
||||
Task also supports Windows thanks to [this shell interpreter for Go][sh].
|
||||
- Great for code generation: you can easily [prevent a task from running](/usage#prevent-unnecessary-work)
|
||||
if a given set of files haven't changed since last run (based either on its
|
||||
timestamp or content).
|
||||
|
||||
[make]: https://www.gnu.org/software/make/
|
||||
[go]: https://go.dev/
|
||||
[yaml]: http://yaml.org/
|
||||
[homebrew]: https://brew.sh/
|
||||
[snapcraft]: https://snapcraft.io/
|
||||
[scoop]: https://scoop.sh/
|
||||
[sh]: https://github.com/mvdan/sh
|
||||
60
docs/docs/releasing.md
Normal file
60
docs/docs/releasing.md
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
slug: /releasing/
|
||||
sidebar_position: 8
|
||||
---
|
||||
|
||||
# Releasing
|
||||
|
||||
The release process of Task is done with the help of
|
||||
[GoReleaser][goreleaser]. You can test the release process locally by calling
|
||||
the `test-release` task of the Taskfile.
|
||||
|
||||
[GitHub Actions](https://github.com/go-task/task/actions) should release
|
||||
artifacts automatically when a new Git tag is pushed to master
|
||||
(raw executables and DEB and RPM packages).
|
||||
|
||||
Since v3.15.0, raw executables can also be reproduced and verified locally by
|
||||
checking out a specific tag and calling `goreleaser build`, using the Go version
|
||||
defined in the above GitHub Actions.
|
||||
|
||||
# Homebrew
|
||||
|
||||
Goreleaser will automatically push a new commit to the
|
||||
[Formula/go-task.rb][gotaskrb] file in the [Homebrew tap][homebrewtap]
|
||||
repository to release the new version.
|
||||
|
||||
# npm
|
||||
|
||||
To release to npm update the version in the [`package.json`][packagejson] file
|
||||
and then run `task npm:publish` to push it.
|
||||
|
||||
# Snapcraft
|
||||
|
||||
The [snap package][snappackage] requires to manual steps to release a new
|
||||
version:
|
||||
|
||||
* Updating the current version on [snapcraft.yaml][snapcraftyaml].
|
||||
* Moving both `amd64`, `armhf` and `arm64` new artifacts to the stable channel on
|
||||
the [Snapcraft dashboard][snapcraftdashboard].
|
||||
|
||||
# Scoop
|
||||
|
||||
Scoop is a command-line package manager for the Windows operating system.
|
||||
Scoop package manifests are maintained by the community.
|
||||
Scoop owners usually take care of updating versions there by editing [this file](https://github.com/lukesampson/scoop-extras/blob/master/bucket/task.json).
|
||||
If you think its Task version is outdated, open an issue to let us know.
|
||||
|
||||
# Nix
|
||||
|
||||
Nix is a community owned installation method. Nix package maintainers usually take care
|
||||
of updating versions there by editing
|
||||
[this file](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/development/tools/go-task/default.nix).
|
||||
If you think its Task version is outdated, open an issue to let us know.
|
||||
|
||||
[goreleaser]: https://goreleaser.com/
|
||||
[homebrewtap]: https://github.com/go-task/homebrew-tap
|
||||
[gotaskrb]: https://github.com/go-task/homebrew-tap/blob/master/Formula/go-task.rb
|
||||
[packagejson]: https://github.com/go-task/task/blob/master/package.json#L3
|
||||
[snappackage]: https://github.com/go-task/snap
|
||||
[snapcraftyaml]: https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2
|
||||
[snapcraftdashboard]: https://snapcraft.io/task/releases
|
||||
216
docs/docs/styleguide.md
Normal file
216
docs/docs/styleguide.md
Normal file
@@ -0,0 +1,216 @@
|
||||
---
|
||||
slug: /styleguide/
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# Styleguide
|
||||
|
||||
This is the official Task styleguide for `Taskfile.yml` files. This guide
|
||||
contains some basic instructions to keep your Taskfile clean and familiar to
|
||||
other users.
|
||||
|
||||
This contains general guidelines, but they don't necessarily need to be strictly
|
||||
followed. Feel free to disagree and proceed differently at some point if you
|
||||
need or want to. Also, feel free to open issues or pull requests with
|
||||
improvements to this guide.
|
||||
|
||||
## Use `Taskfile.yml` and not `taskfile.yml`
|
||||
|
||||
```yaml
|
||||
# bad
|
||||
taskfile.yml
|
||||
|
||||
|
||||
# good
|
||||
Taskfile.yml
|
||||
```
|
||||
|
||||
This is important especially for Linux users. Windows and macOS have case
|
||||
insensitive filesystems, so `taskfile.yml` will end up working, even that not
|
||||
officially supported. On Linux, only `Taskfile.yml` will work, though.
|
||||
|
||||
## Use the correct order of keywords
|
||||
|
||||
- `version:`
|
||||
- `includes:`
|
||||
- Configuration ones, like `output:`, `silent:`, `method:` and `run:`
|
||||
- `vars:`
|
||||
- `env:`, `dotenv:`
|
||||
- `tasks:`
|
||||
|
||||
## Use 2 spaces for indentation
|
||||
|
||||
This is the most common convention for YAML files, and Task follows it.
|
||||
|
||||
```yaml
|
||||
# bad
|
||||
tasks:
|
||||
foo:
|
||||
cmds:
|
||||
- echo 'foo'
|
||||
|
||||
|
||||
# good
|
||||
tasks:
|
||||
foo:
|
||||
cmds:
|
||||
- echo 'foo'
|
||||
```
|
||||
|
||||
## Separate with spaces the mains sections
|
||||
|
||||
```yaml
|
||||
# bad
|
||||
version: '3'
|
||||
includes:
|
||||
docker: ./docker/Taskfile.yml
|
||||
output: prefixed
|
||||
vars:
|
||||
FOO: bar
|
||||
env:
|
||||
BAR: baz
|
||||
tasks:
|
||||
# ...
|
||||
|
||||
|
||||
# good
|
||||
version: '3'
|
||||
|
||||
includes:
|
||||
docker: ./docker/Taskfile.yml
|
||||
|
||||
output: prefixed
|
||||
|
||||
vars:
|
||||
FOO: bar
|
||||
|
||||
env:
|
||||
BAR: baz
|
||||
|
||||
tasks:
|
||||
# ...
|
||||
```
|
||||
|
||||
## Add spaces between tasks
|
||||
|
||||
```yaml
|
||||
# bad
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
foo:
|
||||
cmds:
|
||||
- echo 'foo'
|
||||
bar:
|
||||
cmds:
|
||||
- echo 'bar'
|
||||
baz:
|
||||
cmds:
|
||||
- echo 'baz'
|
||||
|
||||
|
||||
# good
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
foo:
|
||||
cmds:
|
||||
- echo 'foo'
|
||||
|
||||
bar:
|
||||
cmds:
|
||||
- echo 'bar'
|
||||
|
||||
baz:
|
||||
cmds:
|
||||
- echo 'baz'
|
||||
```
|
||||
|
||||
## Use upper-case variable names
|
||||
|
||||
```yaml
|
||||
# bad
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
binary_name: myapp
|
||||
|
||||
tasks:
|
||||
build:
|
||||
cmds:
|
||||
- go build -o {{.binary_name}} .
|
||||
|
||||
|
||||
# good
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
BINARY_NAME: myapp
|
||||
|
||||
tasks:
|
||||
build:
|
||||
cmds:
|
||||
- go build -o {{.BINARY_NAME}} .
|
||||
```
|
||||
|
||||
## Don't wrap vars in spaces when templating
|
||||
|
||||
```yaml
|
||||
# bad
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
greet:
|
||||
cmds:
|
||||
- echo '{{ .MESSAGE }}'
|
||||
|
||||
|
||||
# good
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
greet:
|
||||
cmds:
|
||||
- echo '{{.MESSAGE}}'
|
||||
```
|
||||
|
||||
This convention is also used by most people for any Go templating.
|
||||
|
||||
## Separate task name words with a dash
|
||||
|
||||
```yaml
|
||||
# bad
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
do_something_fancy:
|
||||
cmds:
|
||||
- echo 'Do something'
|
||||
|
||||
|
||||
# good
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
do-something-fancy:
|
||||
cmds:
|
||||
- echo 'Do something'
|
||||
```
|
||||
|
||||
## Use colon for task namespacing
|
||||
|
||||
```yaml
|
||||
# good
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
docker:build:
|
||||
cmds:
|
||||
- docker ...
|
||||
|
||||
docker:run:
|
||||
cmds:
|
||||
- docker-compose ...
|
||||
```
|
||||
|
||||
This is also done automatically when using included Taskfiles.
|
||||
230
docs/docs/taskfile_versions.md
Normal file
230
docs/docs/taskfile_versions.md
Normal file
@@ -0,0 +1,230 @@
|
||||
---
|
||||
slug: /taskfile-versions/
|
||||
sidebar_position: 9
|
||||
---
|
||||
|
||||
# Taskfile Versions
|
||||
|
||||
The Taskfile syntax and features changed with time. This document explains what
|
||||
changed on each version and how to upgrade your Taskfile.
|
||||
|
||||
## What the Taskfile version mean
|
||||
|
||||
The Taskfile version follows the Task version. E.g. the change to Taskfile
|
||||
version `2` means that Task `v2.0.0` should be release to support it.
|
||||
|
||||
The `version:` key on Taskfile accepts a semver string, so either `2`, `2.0` or
|
||||
`2.0.0` is accepted. If you choose to use `2.0` Task will not enable future
|
||||
`2.1` features, but if you choose to use `2`, then any `2.x.x` features will be
|
||||
available, but not `3.0.0+`.
|
||||
|
||||
## Version 1
|
||||
|
||||
> NOTE: Taskfiles in version 1 are not supported on Task >= v3.0.0 anymore.
|
||||
|
||||
In the first version of the `Taskfile`, the `version:` key was not available,
|
||||
because the tasks was in the root of the YAML document. Like this:
|
||||
|
||||
```yaml
|
||||
echo:
|
||||
cmds:
|
||||
- echo "Hello, World!"
|
||||
```
|
||||
|
||||
The variable priority order was also different:
|
||||
|
||||
1. Call variables
|
||||
2. Environment
|
||||
3. Task variables
|
||||
4. `Taskvars.yml` variables
|
||||
|
||||
## Version 2.0
|
||||
|
||||
At version 2, we introduced the `version:` key, to allow us to evolve Task
|
||||
with new features without breaking existing Taskfiles. The new syntax is as
|
||||
follows:
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
tasks:
|
||||
echo:
|
||||
cmds:
|
||||
- echo "Hello, World!"
|
||||
```
|
||||
|
||||
Version 2 allows you to write global variables directly in the Taskfile,
|
||||
if you don't want to create a `Taskvars.yml`:
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
vars:
|
||||
GREETING: Hello, World!
|
||||
|
||||
tasks:
|
||||
greet:
|
||||
cmds:
|
||||
- echo "{{.GREETING}}"
|
||||
```
|
||||
|
||||
The variable priority order changed to the following:
|
||||
|
||||
1. Task variables
|
||||
2. Call variables
|
||||
3. Taskfile variables
|
||||
4. Taskvars file variables
|
||||
5. Environment variables
|
||||
|
||||
A new global option was added to configure the number of variables expansions
|
||||
(which default to 2):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
expansions: 3
|
||||
|
||||
vars:
|
||||
FOO: foo
|
||||
BAR: bar
|
||||
BAZ: baz
|
||||
FOOBAR: "{{.FOO}}{{.BAR}}"
|
||||
FOOBARBAZ: "{{.FOOBAR}}{{.BAZ}}"
|
||||
|
||||
tasks:
|
||||
default:
|
||||
cmds:
|
||||
- echo "{{.FOOBARBAZ}}"
|
||||
```
|
||||
|
||||
## Version 2.1
|
||||
|
||||
Version 2.1 includes a global `output` option, to allow having more control
|
||||
over how commands output are printed to the console
|
||||
(see [documentation][output] for more info):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
output: prefixed
|
||||
|
||||
tasks:
|
||||
server:
|
||||
cmds:
|
||||
- go run main.go
|
||||
prefix: server
|
||||
```
|
||||
|
||||
From this version it's also possible to ignore errors of a command or task
|
||||
(check documentation [here][ignore_errors]):
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
tasks:
|
||||
example-1:
|
||||
cmds:
|
||||
- cmd: exit 1
|
||||
ignore_error: true
|
||||
- echo "This will be print"
|
||||
|
||||
example-2:
|
||||
cmds:
|
||||
- exit 1
|
||||
- echo "This will be print"
|
||||
ignore_error: true
|
||||
```
|
||||
|
||||
## Version 2.2
|
||||
|
||||
Version 2.2 comes with a global `includes` options to include other
|
||||
Taskfiles:
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
includes:
|
||||
docs: ./documentation # will look for ./documentation/Taskfile.yml
|
||||
docker: ./DockerTasks.yml
|
||||
```
|
||||
|
||||
## Version 2.6
|
||||
|
||||
Version 2.6 comes with `preconditions` stanza in tasks.
|
||||
|
||||
```yaml
|
||||
version: '2'
|
||||
|
||||
tasks:
|
||||
upload_environment:
|
||||
preconditions:
|
||||
- test -f .env
|
||||
cmds:
|
||||
- aws s3 cp .env s3://myenvironment
|
||||
```
|
||||
|
||||
Please check the [documentation][includes]
|
||||
|
||||
[output]: usage.md#output-syntax
|
||||
[ignore_errors]: usage.md#ignore-errors
|
||||
[includes]: usage.md#including-other-taskfiles
|
||||
|
||||
## Version 3
|
||||
|
||||
These are some major changes done on `v3`:
|
||||
|
||||
- Task's output will now be colored
|
||||
- Added support for `.env` like files
|
||||
- Added `label:` setting to task so one can override how the task name
|
||||
appear in the logs
|
||||
- A global `method:` was added to allow setting the default method,
|
||||
and Task's default changed to `checksum`
|
||||
- Two magic variables were added when using `status:`: `CHECKSUM` and
|
||||
`TIMESTAMP` which contains, respectively, the md5 checksum and greatest
|
||||
modification timestamp of the files listed on `sources:`
|
||||
- Also, the `TASK` variable is always available with the current task name
|
||||
- CLI variables are always treated as global variables
|
||||
- Added `dir:` option to `includes` to allow choosing on which directory an
|
||||
included Taskfile will run:
|
||||
|
||||
```yaml
|
||||
includes:
|
||||
docs:
|
||||
taskfile: ./docs
|
||||
dir: ./docs
|
||||
```
|
||||
|
||||
- Implemented short task syntax. All below syntaxes are equivalent:
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
print:
|
||||
cmds:
|
||||
- echo "Hello, World!"
|
||||
```
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
print:
|
||||
- echo "Hello, World!"
|
||||
```
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
print: echo "Hello, World!"
|
||||
```
|
||||
|
||||
- There was a major refactor on how variables are handled. They're now easier
|
||||
to understand. The `expansions:` setting was removed as it became unncessary.
|
||||
This is the order in which Task will process variables, each level can see
|
||||
the variables set by the previous one and override those.
|
||||
- Environment variables
|
||||
- Global + CLI variables
|
||||
- Call variables
|
||||
- Task variables
|
||||
1294
docs/docs/usage.md
Normal file
1294
docs/docs/usage.md
Normal file
File diff suppressed because it is too large
Load Diff
179
docs/docusaurus.config.js
Normal file
179
docs/docusaurus.config.js
Normal file
@@ -0,0 +1,179 @@
|
||||
// @ts-check
|
||||
// Note: type annotations allow type checking and IDEs autocompletion
|
||||
|
||||
const lightCodeTheme = require('./src/themes/prismLight');
|
||||
const darkCodeTheme = require('./src/themes/prismDark');
|
||||
|
||||
const GITHUB_URL = 'https://github.com/go-task/task';
|
||||
const TWITTER_URL = 'https://twitter.com/taskfiledev';
|
||||
const DISCORD_URL = 'https://discord.gg/6TY36E39UK';
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'Task',
|
||||
tagline: 'A task runner / simpler Make alternative written in Go ',
|
||||
url: 'https://taskfile.dev',
|
||||
baseUrl: '/',
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'throw',
|
||||
favicon: 'img/favicon.ico',
|
||||
|
||||
organizationName: 'go-task',
|
||||
projectName: 'task',
|
||||
deploymentBranch: 'gh-pages',
|
||||
|
||||
i18n: {
|
||||
defaultLocale: 'en',
|
||||
locales: ['en']
|
||||
},
|
||||
|
||||
presets: [
|
||||
[
|
||||
'classic',
|
||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||
({
|
||||
docs: {
|
||||
routeBasePath: '/',
|
||||
sidebarPath: require.resolve('./sidebars.js')
|
||||
},
|
||||
blog: false,
|
||||
theme: {
|
||||
customCss: [
|
||||
require.resolve('./src/css/custom.css'),
|
||||
require.resolve('./src/css/carbon.css')
|
||||
]
|
||||
},
|
||||
gtag: {
|
||||
trackingID: 'G-4RT25NXQ7N',
|
||||
anonymizeIP: true
|
||||
},
|
||||
sitemap: {
|
||||
changefreq: 'weekly',
|
||||
priority: 0.5,
|
||||
ignorePatterns: ['/tags/**']
|
||||
}
|
||||
})
|
||||
]
|
||||
],
|
||||
|
||||
themeConfig:
|
||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
||||
({
|
||||
metadata: [
|
||||
{
|
||||
name: 'og:image',
|
||||
content: 'https://taskfile.dev/img/og-image.png'
|
||||
}
|
||||
],
|
||||
navbar: {
|
||||
title: 'Task',
|
||||
logo: {
|
||||
alt: 'Task Logo',
|
||||
src: 'img/logo.svg'
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: 'doc',
|
||||
docId: 'installation',
|
||||
position: 'left',
|
||||
label: 'Installation'
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
docId: 'usage',
|
||||
position: 'left',
|
||||
label: 'Usage'
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
docId: 'api_reference',
|
||||
position: 'left',
|
||||
label: 'API'
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
docId: 'donate',
|
||||
position: 'left',
|
||||
label: 'Donate'
|
||||
},
|
||||
{
|
||||
href: GITHUB_URL,
|
||||
label: 'GitHub',
|
||||
position: 'right'
|
||||
},
|
||||
{
|
||||
href: TWITTER_URL,
|
||||
label: 'Twitter',
|
||||
position: 'right'
|
||||
},
|
||||
{
|
||||
href: DISCORD_URL,
|
||||
label: 'Discord',
|
||||
position: 'right'
|
||||
}
|
||||
]
|
||||
},
|
||||
footer: {
|
||||
style: 'dark',
|
||||
links: [
|
||||
{
|
||||
title: 'Pages',
|
||||
items: [
|
||||
{
|
||||
label: 'Installation',
|
||||
to: '/installation/'
|
||||
},
|
||||
{
|
||||
label: 'Usage',
|
||||
to: '/usage/'
|
||||
},
|
||||
{
|
||||
label: 'Donate',
|
||||
to: '/donate/'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Community',
|
||||
items: [
|
||||
{
|
||||
label: 'GitHub',
|
||||
href: GITHUB_URL
|
||||
},
|
||||
{
|
||||
label: 'Twitter',
|
||||
href: TWITTER_URL
|
||||
},
|
||||
{
|
||||
label: 'Discord',
|
||||
href: DISCORD_URL
|
||||
},
|
||||
{
|
||||
label: 'OpenCollective',
|
||||
href: 'https://opencollective.com/task'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
prism: {
|
||||
theme: lightCodeTheme,
|
||||
darkTheme: darkCodeTheme
|
||||
},
|
||||
// NOTE(@andreynering): Don't worry, these keys are meant to be public =)
|
||||
algolia: {
|
||||
appId: '7IZIJ13AI7',
|
||||
apiKey: '34b64ae4fc8d9da43d9a13d9710aaddc',
|
||||
indexName: 'taskfile'
|
||||
}
|
||||
}),
|
||||
|
||||
scripts: [
|
||||
{
|
||||
src: '/js/carbon.js',
|
||||
async: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
41
docs/package.json
Normal file
41
docs/package.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "taskfile-dev",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.20",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.20",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"clsx": "^1.1.1",
|
||||
"prism-react-renderer": "^1.3.1",
|
||||
"raw-loader": "^4.0.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "2.0.0-beta.20"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
4
docs/prettier.config.js
Normal file
4
docs/prettier.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
trailingComma: 'none',
|
||||
singleQuote: true
|
||||
};
|
||||
14
docs/sidebars.js
Normal file
14
docs/sidebars.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
|
||||
const sidebars = {
|
||||
tutorialSidebar: [
|
||||
{ type: 'autogenerated', dirName: '.' },
|
||||
{
|
||||
type: 'html',
|
||||
value: '<div id="sidebar-ads"></div>'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = sidebars;
|
||||
0
docs/src/components/.keep
Normal file
0
docs/src/components/.keep
Normal file
65
docs/src/css/carbon.css
Normal file
65
docs/src/css/carbon.css
Normal file
@@ -0,0 +1,65 @@
|
||||
#carbonads * {
|
||||
margin: initial;
|
||||
padding: initial;
|
||||
}
|
||||
#carbonads {
|
||||
display: flex;
|
||||
max-width: 330px;
|
||||
background-color: hsl(0, 0%, 98%);
|
||||
box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, 0.1);
|
||||
z-index: 100;
|
||||
}
|
||||
#carbonads a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
#carbonads a:hover {
|
||||
color: inherit;
|
||||
}
|
||||
#carbonads span {
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
#carbonads .carbon-wrap {
|
||||
display: flex;
|
||||
}
|
||||
#carbonads .carbon-img {
|
||||
display: block;
|
||||
margin: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
#carbonads .carbon-img img {
|
||||
display: block;
|
||||
}
|
||||
#carbonads .carbon-text {
|
||||
font-size: 13px;
|
||||
padding: 10px;
|
||||
margin-bottom: 16px;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
}
|
||||
#carbonads .carbon-poweredby {
|
||||
display: block;
|
||||
padding: 6px 8px;
|
||||
background: #f1f1f2;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
font-weight: 600;
|
||||
font-size: 8px;
|
||||
line-height: 1;
|
||||
border-top-left-radius: 3px;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
[data-theme='dark'] #carbonads {
|
||||
background-color: hsl(0, 0%, 35%);
|
||||
box-shadow: 0 1px 4px 1px hsl(0, 0%, 55%);
|
||||
}
|
||||
|
||||
[data-theme='dark'] #carbonads .carbon-poweredby {
|
||||
background-color: hsl(0, 0%, 55%);
|
||||
}
|
||||
29
docs/src/css/custom.css
Normal file
29
docs/src/css/custom.css
Normal file
@@ -0,0 +1,29 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,400;0,700;1,400;1,700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&display=swap');
|
||||
|
||||
:root {
|
||||
--ifm-font-family-base: Roboto, system-ui, -apple-system, Segoe UI, Ubuntu, Cantarell, Noto Sans, sans-serif, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
|
||||
--ifm-font-family-monospace: 'Roboto Mono', SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
|
||||
|
||||
--ifm-color-primary: #43ABA2 ;
|
||||
--ifm-color-primary-dark: #3AB2A6;
|
||||
--ifm-color-primary-darker: #32B8AB;
|
||||
--ifm-color-primary-darkest: #29BEB0;
|
||||
--ifm-color-primary-light: #4CA59D;
|
||||
--ifm-color-primary-lighter: #559F98;
|
||||
--ifm-color-primary-lightest: #5D9993;
|
||||
--ifm-code-font-size: 95%;
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
[data-theme='dark'] {
|
||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.code-block--max-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#carbonads {
|
||||
margin-top: 30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
0
docs/src/pages/.keep
Normal file
0
docs/src/pages/.keep
Normal file
79
docs/src/themes/prismDark.js
Normal file
79
docs/src/themes/prismDark.js
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const darkTheme = require('prism-react-renderer/themes/vsDark/index.cjs.js');
|
||||
|
||||
module.exports = {
|
||||
plain: {
|
||||
color: '#D4D4D4',
|
||||
backgroundColor: '#212121'
|
||||
},
|
||||
styles: [
|
||||
...darkTheme.styles,
|
||||
{
|
||||
types: ['title'],
|
||||
style: {
|
||||
color: '#569CD6',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['property', 'parameter'],
|
||||
style: {
|
||||
color: '#9CDCFE'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['script'],
|
||||
style: {
|
||||
color: '#D4D4D4'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['boolean', 'arrow', 'atrule', 'tag'],
|
||||
style: {
|
||||
color: '#569CD6'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['number', 'color', 'unit'],
|
||||
style: {
|
||||
color: '#B5CEA8'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['font-matter'],
|
||||
style: {
|
||||
color: '#CE9178'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['keyword', 'rule'],
|
||||
style: {
|
||||
color: '#C586C0'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['regex'],
|
||||
style: {
|
||||
color: '#D16969'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['maybe-class-name'],
|
||||
style: {
|
||||
color: '#4EC9B0'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['constant'],
|
||||
style: {
|
||||
color: '#4FC1FF'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
100
docs/src/themes/prismLight.js
Normal file
100
docs/src/themes/prismLight.js
Normal file
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const lightTheme = require('prism-react-renderer/themes/github/index.cjs.js');
|
||||
|
||||
module.exports = {
|
||||
...lightTheme,
|
||||
styles: [
|
||||
...lightTheme.styles,
|
||||
{
|
||||
types: ['title'],
|
||||
style: {
|
||||
color: '#0550AE',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['parameter'],
|
||||
style: {
|
||||
color: '#953800'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['boolean', 'rule', 'color', 'number', 'constant', 'property'],
|
||||
style: {
|
||||
color: '#005CC5'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['atrule', 'tag'],
|
||||
style: {
|
||||
color: '#22863A'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['script'],
|
||||
style: {
|
||||
color: '#24292E'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['operator', 'unit', 'rule'],
|
||||
style: {
|
||||
color: '#D73A49'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['font-matter', 'string', 'attr-value'],
|
||||
style: {
|
||||
color: '#C6105F'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['class-name'],
|
||||
style: {
|
||||
color: '#116329'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['attr-name'],
|
||||
style: {
|
||||
color: '#0550AE'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['keyword'],
|
||||
style: {
|
||||
color: '#CF222E'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['function'],
|
||||
style: {
|
||||
color: '#8250DF'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['selector'],
|
||||
style: {
|
||||
color: '#6F42C1'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['variable'],
|
||||
style: {
|
||||
color: '#E36209'
|
||||
}
|
||||
},
|
||||
{
|
||||
types: ['comment'],
|
||||
style: {
|
||||
color: '#6B6B6B'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
0
docs/static/.nojekyll
vendored
Normal file
0
docs/static/.nojekyll
vendored
Normal file
1
docs/static/CNAME
vendored
Normal file
1
docs/static/CNAME
vendored
Normal file
@@ -0,0 +1 @@
|
||||
taskfile.dev
|
||||
BIN
docs/static/img/favicon.ico
vendored
Normal file
BIN
docs/static/img/favicon.ico
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
BIN
docs/static/img/logo.png
vendored
Normal file
BIN
docs/static/img/logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
1
docs/static/img/logo.svg
vendored
Normal file
1
docs/static/img/logo.svg
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox="0 0 375 375"><path fill="#29beb0" d="M 187.570312 190.933594 L 187.570312 375 L 30.070312 279.535156 L 30.070312 95.464844 Z"/><path fill="#69d2c8" d="M 187.570312 190.933594 L 187.570312 375 L 345.070312 279.535156 L 345.070312 95.464844 Z"/><path fill="#94dfd8" d="M 187.570312 190.933594 L 30.070312 95.464844 L 187.570312 0 L 345.070312 95.464844 Z"/></svg>
|
||||
|
After Width: | Height: | Size: 435 B |
1
docs/static/img/logo_mono.svg
vendored
Normal file
1
docs/static/img/logo_mono.svg
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox="0 0 375 375"><path d="M 29.021972 281.445466 L 183.370289 375 L 183.370289 194.622441 L 29.021972 101.064089 Z M 345.978037 281.445466 L 345.978037 101.064079 L 191.629731 194.622431 L 191.629731 375 Z M 342.140723 93.731759 L 187.5 0 L 32.859297 93.731759 L 187.5 187.467349 Z"/></svg>
|
||||
|
After Width: | Height: | Size: 360 B |
BIN
docs/static/img/og-image.png
vendored
Normal file
BIN
docs/static/img/og-image.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
BIN
docs/static/img/pix.png
vendored
Normal file
BIN
docs/static/img/pix.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
387
docs/static/install.sh
vendored
Executable file
387
docs/static/install.sh
vendored
Executable file
@@ -0,0 +1,387 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
# Code generated by godownloader on 2021-01-12T13:40:40Z. DO NOT EDIT.
|
||||
#
|
||||
|
||||
usage() {
|
||||
this=$1
|
||||
cat <<EOF
|
||||
$this: download go binaries for go-task/task
|
||||
|
||||
Usage: $this [-b] bindir [-d] [tag]
|
||||
-b sets bindir or installation directory, Defaults to ./bin
|
||||
-d turns on debug logging
|
||||
[tag] is a tag from
|
||||
https://github.com/go-task/task/releases
|
||||
If tag is missing, then the latest will be used.
|
||||
|
||||
Generated by godownloader
|
||||
https://github.com/goreleaser/godownloader
|
||||
|
||||
EOF
|
||||
exit 2
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
#BINDIR is ./bin unless set be ENV
|
||||
# over-ridden by flag below
|
||||
|
||||
BINDIR=${BINDIR:-./bin}
|
||||
while getopts "b:dh?x" arg; do
|
||||
case "$arg" in
|
||||
b) BINDIR="$OPTARG" ;;
|
||||
d) log_set_priority 10 ;;
|
||||
h | \?) usage "$0" ;;
|
||||
x) set -x ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
TAG=$1
|
||||
}
|
||||
# this function wraps all the destructive operations
|
||||
# if a curl|bash cuts off the end of the script due to
|
||||
# network, either nothing will happen or will syntax error
|
||||
# out preventing half-done work
|
||||
execute() {
|
||||
tmpdir=$(mktemp -d)
|
||||
log_debug "downloading files into ${tmpdir}"
|
||||
http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}"
|
||||
http_download "${tmpdir}/${CHECKSUM}" "${CHECKSUM_URL}"
|
||||
hash_sha256_verify "${tmpdir}/${TARBALL}" "${tmpdir}/${CHECKSUM}"
|
||||
srcdir="${tmpdir}"
|
||||
(cd "${tmpdir}" && untar "${TARBALL}")
|
||||
test ! -d "${BINDIR}" && install -d "${BINDIR}"
|
||||
for binexe in $BINARIES; do
|
||||
if [ "$OS" = "windows" ]; then
|
||||
binexe="${binexe}.exe"
|
||||
fi
|
||||
install "${srcdir}/${binexe}" "${BINDIR}/"
|
||||
log_info "installed ${BINDIR}/${binexe}"
|
||||
done
|
||||
rm -rf "${tmpdir}"
|
||||
}
|
||||
get_binaries() {
|
||||
case "$PLATFORM" in
|
||||
darwin/amd64) BINARIES="task" ;;
|
||||
darwin/arm64) BINARIES="task" ;;
|
||||
darwin/armv5) BINARIES="task" ;;
|
||||
darwin/armv6) BINARIES="task" ;;
|
||||
darwin/armv7) BINARIES="task" ;;
|
||||
linux/386) BINARIES="task" ;;
|
||||
linux/amd64) BINARIES="task" ;;
|
||||
linux/arm64) BINARIES="task" ;;
|
||||
linux/armv5) BINARIES="task" ;;
|
||||
linux/armv6) BINARIES="task" ;;
|
||||
linux/armv7) BINARIES="task" ;;
|
||||
windows/386) BINARIES="task" ;;
|
||||
windows/amd64) BINARIES="task" ;;
|
||||
windows/arm64) BINARIES="task" ;;
|
||||
windows/armv5) BINARIES="task" ;;
|
||||
windows/armv6) BINARIES="task" ;;
|
||||
windows/armv7) BINARIES="task" ;;
|
||||
*)
|
||||
log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
tag_to_version() {
|
||||
if [ -z "${TAG}" ]; then
|
||||
log_info "checking GitHub for latest tag"
|
||||
else
|
||||
log_info "checking GitHub for tag '${TAG}'"
|
||||
fi
|
||||
REALTAG=$(github_release "$OWNER/$REPO" "${TAG}") && true
|
||||
if test -z "$REALTAG"; then
|
||||
log_crit "unable to find '${TAG}' - use 'latest' or see https://github.com/${PREFIX}/releases for details"
|
||||
exit 1
|
||||
fi
|
||||
# if version starts with 'v', remove it
|
||||
TAG="$REALTAG"
|
||||
VERSION=${TAG#v}
|
||||
}
|
||||
adjust_format() {
|
||||
# change format (tar.gz or zip) based on OS
|
||||
case ${OS} in
|
||||
windows) FORMAT=zip ;;
|
||||
esac
|
||||
true
|
||||
}
|
||||
adjust_os() {
|
||||
# adjust archive name based on OS
|
||||
true
|
||||
}
|
||||
adjust_arch() {
|
||||
# adjust archive name based on ARCH
|
||||
true
|
||||
}
|
||||
|
||||
cat /dev/null <<EOF
|
||||
------------------------------------------------------------------------
|
||||
https://github.com/client9/shlib - portable posix shell functions
|
||||
Public domain - http://unlicense.org
|
||||
https://github.com/client9/shlib/blob/master/LICENSE.md
|
||||
but credit (and pull requests) appreciated.
|
||||
------------------------------------------------------------------------
|
||||
EOF
|
||||
is_command() {
|
||||
command -v "$1" >/dev/null
|
||||
}
|
||||
echoerr() {
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
log_prefix() {
|
||||
echo "$0"
|
||||
}
|
||||
_logp=6
|
||||
log_set_priority() {
|
||||
_logp="$1"
|
||||
}
|
||||
log_priority() {
|
||||
if test -z "$1"; then
|
||||
echo "$_logp"
|
||||
return
|
||||
fi
|
||||
[ "$1" -le "$_logp" ]
|
||||
}
|
||||
log_tag() {
|
||||
case $1 in
|
||||
0) echo "emerg" ;;
|
||||
1) echo "alert" ;;
|
||||
2) echo "crit" ;;
|
||||
3) echo "err" ;;
|
||||
4) echo "warning" ;;
|
||||
5) echo "notice" ;;
|
||||
6) echo "info" ;;
|
||||
7) echo "debug" ;;
|
||||
*) echo "$1" ;;
|
||||
esac
|
||||
}
|
||||
log_debug() {
|
||||
log_priority 7 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 7)" "$@"
|
||||
}
|
||||
log_info() {
|
||||
log_priority 6 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 6)" "$@"
|
||||
}
|
||||
log_err() {
|
||||
log_priority 3 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 3)" "$@"
|
||||
}
|
||||
log_crit() {
|
||||
log_priority 2 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 2)" "$@"
|
||||
}
|
||||
uname_os() {
|
||||
os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
case "$os" in
|
||||
cygwin_nt*) os="windows" ;;
|
||||
mingw*) os="windows" ;;
|
||||
msys_nt*) os="windows" ;;
|
||||
esac
|
||||
echo "$os"
|
||||
}
|
||||
uname_arch() {
|
||||
arch=$(uname -m)
|
||||
case $arch in
|
||||
x86_64) arch="amd64" ;;
|
||||
x86) arch="386" ;;
|
||||
i686) arch="386" ;;
|
||||
i386) arch="386" ;;
|
||||
aarch64) arch="arm64" ;;
|
||||
armv5*) arch="arm" ;;
|
||||
armv6*) arch="arm" ;;
|
||||
armv7*) arch="arm" ;;
|
||||
esac
|
||||
echo ${arch}
|
||||
}
|
||||
uname_os_check() {
|
||||
os=$(uname_os)
|
||||
case "$os" in
|
||||
darwin) return 0 ;;
|
||||
dragonfly) return 0 ;;
|
||||
freebsd) return 0 ;;
|
||||
linux) return 0 ;;
|
||||
android) return 0 ;;
|
||||
nacl) return 0 ;;
|
||||
netbsd) return 0 ;;
|
||||
openbsd) return 0 ;;
|
||||
plan9) return 0 ;;
|
||||
solaris) return 0 ;;
|
||||
windows) return 0 ;;
|
||||
esac
|
||||
log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
|
||||
return 1
|
||||
}
|
||||
uname_arch_check() {
|
||||
arch=$(uname_arch)
|
||||
case "$arch" in
|
||||
386) return 0 ;;
|
||||
amd64) return 0 ;;
|
||||
arm64) return 0 ;;
|
||||
arm) return 0 ;;
|
||||
ppc64) return 0 ;;
|
||||
ppc64le) return 0 ;;
|
||||
mips) return 0 ;;
|
||||
mipsle) return 0 ;;
|
||||
mips64) return 0 ;;
|
||||
mips64le) return 0 ;;
|
||||
s390x) return 0 ;;
|
||||
amd64p32) return 0 ;;
|
||||
esac
|
||||
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
|
||||
return 1
|
||||
}
|
||||
untar() {
|
||||
tarball=$1
|
||||
case "${tarball}" in
|
||||
*.tar.gz | *.tgz) tar --no-same-owner -xzf "${tarball}" ;;
|
||||
*.tar) tar --no-same-owner -xf "${tarball}" ;;
|
||||
*.zip) unzip "${tarball}" ;;
|
||||
*)
|
||||
log_err "untar unknown archive format for ${tarball}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
http_download_curl() {
|
||||
local_file=$1
|
||||
source_url=$2
|
||||
header=$3
|
||||
if [ -z "$header" ]; then
|
||||
code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
|
||||
else
|
||||
code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
|
||||
fi
|
||||
if [ "$code" != "200" ]; then
|
||||
log_debug "http_download_curl received HTTP status $code"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
http_download_wget() {
|
||||
local_file=$1
|
||||
source_url=$2
|
||||
header=$3
|
||||
if [ -z "$header" ]; then
|
||||
wget -q -O "$local_file" "$source_url"
|
||||
else
|
||||
wget -q --header "$header" -O "$local_file" "$source_url"
|
||||
fi
|
||||
}
|
||||
http_download() {
|
||||
log_debug "http_download $2"
|
||||
if is_command curl; then
|
||||
http_download_curl "$@"
|
||||
return
|
||||
elif is_command wget; then
|
||||
http_download_wget "$@"
|
||||
return
|
||||
fi
|
||||
log_crit "http_download unable to find wget or curl"
|
||||
return 1
|
||||
}
|
||||
http_copy() {
|
||||
tmp=$(mktemp)
|
||||
http_download "${tmp}" "$1" "$2" || return 1
|
||||
body=$(cat "$tmp")
|
||||
rm -f "${tmp}"
|
||||
echo "$body"
|
||||
}
|
||||
github_release() {
|
||||
owner_repo=$1
|
||||
version=$2
|
||||
test -z "$version" && version="latest"
|
||||
giturl="https://github.com/${owner_repo}/releases/${version}"
|
||||
json=$(http_copy "$giturl" "Accept:application/json")
|
||||
test -z "$json" && return 1
|
||||
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
|
||||
test -z "$version" && return 1
|
||||
echo "$version"
|
||||
}
|
||||
hash_sha256() {
|
||||
TARGET=${1:-/dev/stdin}
|
||||
if is_command gsha256sum; then
|
||||
hash=$(gsha256sum "$TARGET") || return 1
|
||||
echo "$hash" | cut -d ' ' -f 1
|
||||
elif is_command sha256sum; then
|
||||
hash=$(sha256sum "$TARGET") || return 1
|
||||
echo "$hash" | cut -d ' ' -f 1
|
||||
elif is_command shasum; then
|
||||
hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1
|
||||
echo "$hash" | cut -d ' ' -f 1
|
||||
elif is_command openssl; then
|
||||
hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1
|
||||
echo "$hash" | cut -d ' ' -f a
|
||||
else
|
||||
log_crit "hash_sha256 unable to find command to compute sha-256 hash"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
hash_sha256_verify() {
|
||||
TARGET=$1
|
||||
checksums=$2
|
||||
if [ -z "$checksums" ]; then
|
||||
log_err "hash_sha256_verify checksum file not specified in arg2"
|
||||
return 1
|
||||
fi
|
||||
BASENAME=${TARGET##*/}
|
||||
want=$(grep "${BASENAME}" "${checksums}" 2>/dev/null | tr '\t' ' ' | cut -d ' ' -f 1)
|
||||
if [ -z "$want" ]; then
|
||||
log_err "hash_sha256_verify unable to find checksum for '${TARGET}' in '${checksums}'"
|
||||
return 1
|
||||
fi
|
||||
got=$(hash_sha256 "$TARGET")
|
||||
if [ "$want" != "$got" ]; then
|
||||
log_err "hash_sha256_verify checksum for '$TARGET' did not verify ${want} vs $got"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
cat /dev/null <<EOF
|
||||
------------------------------------------------------------------------
|
||||
End of functions from https://github.com/client9/shlib
|
||||
------------------------------------------------------------------------
|
||||
EOF
|
||||
|
||||
PROJECT_NAME="task"
|
||||
OWNER=go-task
|
||||
REPO="task"
|
||||
BINARY=task
|
||||
FORMAT=tar.gz
|
||||
OS=$(uname_os)
|
||||
ARCH=$(uname_arch)
|
||||
PREFIX="$OWNER/$REPO"
|
||||
|
||||
# use in logging routines
|
||||
log_prefix() {
|
||||
echo "$PREFIX"
|
||||
}
|
||||
PLATFORM="${OS}/${ARCH}"
|
||||
GITHUB_DOWNLOAD=https://github.com/${OWNER}/${REPO}/releases/download
|
||||
|
||||
uname_os_check "$OS"
|
||||
uname_arch_check "$ARCH"
|
||||
|
||||
parse_args "$@"
|
||||
|
||||
get_binaries
|
||||
|
||||
tag_to_version
|
||||
|
||||
adjust_format
|
||||
|
||||
adjust_os
|
||||
|
||||
adjust_arch
|
||||
|
||||
log_info "found version: ${VERSION} for ${TAG}/${OS}/${ARCH}"
|
||||
|
||||
NAME=${BINARY}_${OS}_${ARCH}
|
||||
TARBALL=${NAME}.${FORMAT}
|
||||
TARBALL_URL=${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}
|
||||
CHECKSUM=task_checksums.txt
|
||||
CHECKSUM_URL=${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUM}
|
||||
|
||||
|
||||
execute
|
||||
29
docs/static/js/carbon.js
vendored
Normal file
29
docs/static/js/carbon.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
(function () {
|
||||
function attachAd() {
|
||||
var el = document.createElement('script');
|
||||
el.setAttribute('type', 'text/javascript');
|
||||
el.setAttribute('id', '_carbonads_js');
|
||||
el.setAttribute(
|
||||
'src',
|
||||
'//cdn.carbonads.com/carbon.js?serve=CESI65QJ&placement=taskfiledev'
|
||||
);
|
||||
el.setAttribute('async', 'async');
|
||||
|
||||
var wrapper = document.getElementById('sidebar-ads');
|
||||
wrapper.innerHTML = '';
|
||||
wrapper.appendChild(el);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
attachAd();
|
||||
|
||||
var currentPath = window.location.pathname;
|
||||
|
||||
setInterval(function () {
|
||||
if (currentPath !== window.location.pathname) {
|
||||
currentPath = window.location.pathname;
|
||||
attachAd();
|
||||
}
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
})();
|
||||
384
docs/static/schema.json
vendored
Normal file
384
docs/static/schema.json
vendored
Normal file
@@ -0,0 +1,384 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema",
|
||||
"title": "Taskfile YAML Schema",
|
||||
"description": "Schema for Taskfile files.",
|
||||
"definitions": {
|
||||
"3": {
|
||||
"env": {
|
||||
"$ref": "#/definitions/3/vars"
|
||||
},
|
||||
"tasks": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^.*$": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/task_call"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/task"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"task": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"cmds": {
|
||||
"description": "A list of commands to be executed.",
|
||||
"$ref": "#/definitions/3/cmds"
|
||||
},
|
||||
"deps": {
|
||||
"description": "A list of dependencies of this task. Tasks defined here will run in parallel before this task.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/task_call"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"description": "Overrides the name of the task in the output when a task is run. Supports variables.",
|
||||
"type": "string"
|
||||
},
|
||||
"desc": {
|
||||
"description": "A short description of the task. This is displayed when calling `task --list`.",
|
||||
"type": "string"
|
||||
},
|
||||
"summary": {
|
||||
"description": "A longer description of the task. This is displayed when calling `task --summary [task]`.",
|
||||
"type": "string"
|
||||
},
|
||||
"aliases": {
|
||||
"description": "A list of alternative names by which the task can be called.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"description": "A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"generates": {
|
||||
"description": "A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"description": "A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"preconditions": {
|
||||
"description": "A list of commands to check if this task should run. If a condition is not met, the task will error.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/3/precondition"
|
||||
}
|
||||
},
|
||||
"dir": {
|
||||
"description": "The directory in which this task should run. Defaults to the current working directory.",
|
||||
"type": "string"
|
||||
},
|
||||
"vars": {
|
||||
"description": "A set of variables that can be used in the task.",
|
||||
"$ref": "#/definitions/3/vars"
|
||||
},
|
||||
"env": {
|
||||
"description": "A set of environment variables that will be made available to shell commands.",
|
||||
"$ref": "#/definitions/3/env"
|
||||
},
|
||||
"silent": {
|
||||
"description": "Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. When combined with the `--list` flag, task descriptions will be hidden.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"interactive": {
|
||||
"description": "Tells task that the command is interactive.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"internal": {
|
||||
"description": "Stops a task from being callable on the command line. It will also be omitted from the output when used with `--list`.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"method": {
|
||||
"description": "Defines which method is used to check the task is up-to-date. `timestamp` will compare the timestamp of the sources and generates files. `checksum` will check the checksum (You probably want to ignore the .task folder in your .gitignore file). `none` skips any validation and always run the task.",
|
||||
"type": "string",
|
||||
"enum": ["none", "checksum", "timestamp"],
|
||||
"default": "none"
|
||||
},
|
||||
"prefix": {
|
||||
"description": "Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is `prefixed`.",
|
||||
"type": "string"
|
||||
},
|
||||
"ignore_error": {
|
||||
"description": "Continue execution if errors happen while executing commands.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"run": {
|
||||
"description": "Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`.",
|
||||
"$ref": "#/definitions/3/run"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cmds": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/3/cmd"
|
||||
}
|
||||
},
|
||||
"cmd": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/cmd_call"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/task_call"
|
||||
}
|
||||
]
|
||||
},
|
||||
"vars": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^.*$": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": ["boolean", "integer", "null", "number", "string"]
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/dynamic_var"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"dynamic_var": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sh": {
|
||||
"type": "string",
|
||||
"description": "The value will be treated as a command and the output assigned"
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"task_call": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"task": {
|
||||
"description": "Name of the task to run",
|
||||
"type": "string"
|
||||
},
|
||||
"vars": {
|
||||
"description": "Values passed to the task called",
|
||||
"$ref": "#/definitions/3/vars"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cmd_call": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cmd": {
|
||||
"description": "Command to run",
|
||||
"type": "string"
|
||||
},
|
||||
"silent": {
|
||||
"description": "Silent mode disables echoing of command before Task runs it",
|
||||
"type": "boolean"
|
||||
},
|
||||
"ignore_error": {
|
||||
"description": "Prevent command from aborting the execution of task even after receiving a status code of 1",
|
||||
"type": "boolean"
|
||||
},
|
||||
"defer": {
|
||||
"description": "",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["cmd"]
|
||||
},
|
||||
"precondition": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/3/precondition_obj"
|
||||
}
|
||||
]
|
||||
},
|
||||
"precondition_obj": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sh": {
|
||||
"description": "Command to run. If that command returns 1, the condition will fail",
|
||||
"type": "string"
|
||||
},
|
||||
"msg": {
|
||||
"description": "Failure message to display when the condition fails",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"run": {
|
||||
"type": "string",
|
||||
"enum": ["always", "once", "when_changed"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"version": {
|
||||
"description": "Specify the Taskfile format that this file conforms to.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number",
|
||||
"enum": [3]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["3"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"description": "Defines how the STDOUT and STDERR are printed when running tasks in parallel. The interleaved output prints lines in real time (default). The group output will print the entire output of a command once, after it finishes, so you won't have live feedback for commands that take a long time to run. The prefix output will prefix every line printed by a command with [task-name] as the prefix, but you can customize the prefix for a command with the prefix: attribute.",
|
||||
"type": "string",
|
||||
"enum": ["interleaved", "group", "prefixed"],
|
||||
"default": "interleaved"
|
||||
},
|
||||
"method": {
|
||||
"description": "Defines which method is used to check the task is up-to-date. (default: checksum)",
|
||||
"type": "string",
|
||||
"enum": ["none", "checksum", "timestamp"],
|
||||
"default": "checksum"
|
||||
},
|
||||
"includes": {
|
||||
"description": "Imports tasks from the specified taskfiles. The tasks described in the given Taskfiles will be available with the informed namespace.",
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^.*$": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"taskfile": {
|
||||
"description": "The path for the Taskfile or directory to be included. If a directory, Task will look for files named `Taskfile.yml` or `Taskfile.yaml` inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile.",
|
||||
"type": "string"
|
||||
},
|
||||
"dir": {
|
||||
"description": "The working directory of the included tasks when run.",
|
||||
"type": "string"
|
||||
},
|
||||
"optional": {
|
||||
"description": "If `true`, no errors will be thrown if the specified file does not exist.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"internal": {
|
||||
"description": "Stops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with `--list`.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"aliases": {
|
||||
"description": "Alternative names for the namespace of the included Taskfile.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"vars": {
|
||||
"description": "A set of variables to apply to the included Taskfile.",
|
||||
"$ref": "#/definitions/3/vars"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"vars": {
|
||||
"description": "A set of global variables.",
|
||||
"$ref": "#/definitions/3/vars"
|
||||
},
|
||||
"env": {
|
||||
"description": "A set of global environment variables.",
|
||||
"$ref": "#/definitions/3/env"
|
||||
},
|
||||
"tasks": {
|
||||
"description": "A set of task definitions.",
|
||||
"$ref": "#/definitions/3/tasks"
|
||||
},
|
||||
"silent": {
|
||||
"description": "Default 'silent' options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"dotenv": {
|
||||
"type": "array",
|
||||
"description": "A list of `.env` file paths to be parsed.",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"run": {
|
||||
"description": "Default 'run' option for this Taskfile. Available options: `always`, `once` and `when_changed`.",
|
||||
"$ref": "#/definitions/3/run"
|
||||
},
|
||||
"interval": {
|
||||
"description": "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.",
|
||||
"$ref": "#/definitions/3/run"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["version"],
|
||||
"anyOf": [
|
||||
{
|
||||
"required": ["includes"]
|
||||
},
|
||||
{
|
||||
"required": ["tasks"]
|
||||
},
|
||||
{
|
||||
"required": ["includes", "tasks"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
7688
docs/yarn.lock
Normal file
7688
docs/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
76
errors.go
76
errors.go
@@ -3,6 +3,9 @@ package task
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"mvdan.cc/sh/v3/interp"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -10,54 +13,55 @@ var (
|
||||
ErrTaskfileAlreadyExists = errors.New("task: A Taskfile already exists")
|
||||
)
|
||||
|
||||
type taskFileNotFound struct {
|
||||
taskFile string
|
||||
}
|
||||
|
||||
func (err taskFileNotFound) Error() string {
|
||||
return fmt.Sprintf(`task: No task file found (is it named "%s"?). Use "task --init" to create a new one`, err.taskFile)
|
||||
}
|
||||
|
||||
type taskNotFoundError struct {
|
||||
taskName string
|
||||
taskName string
|
||||
didYouMean string
|
||||
}
|
||||
|
||||
func (err *taskNotFoundError) Error() string {
|
||||
return fmt.Sprintf(`task: Task "%s" not found`, err.taskName)
|
||||
if err.didYouMean != "" {
|
||||
return fmt.Sprintf(
|
||||
`task: Task %q does not exist. Did you mean %q?`,
|
||||
err.taskName,
|
||||
err.didYouMean,
|
||||
)
|
||||
}
|
||||
|
||||
return fmt.Sprintf(`task: Task %q does not exist`, err.taskName)
|
||||
}
|
||||
|
||||
type taskRunError struct {
|
||||
type multipleTasksWithAliasError struct {
|
||||
aliasName string
|
||||
taskNames []string
|
||||
}
|
||||
|
||||
func (err *multipleTasksWithAliasError) Error() string {
|
||||
return fmt.Sprintf(`task: Multiple tasks (%s) with alias %q found`, strings.Join(err.taskNames, ", "), err.aliasName)
|
||||
}
|
||||
|
||||
type taskInternalError struct {
|
||||
taskName string
|
||||
}
|
||||
|
||||
func (err *taskInternalError) Error() string {
|
||||
return fmt.Sprintf(`task: Task "%s" is internal`, err.taskName)
|
||||
}
|
||||
|
||||
type TaskRunError struct {
|
||||
taskName string
|
||||
err error
|
||||
}
|
||||
|
||||
func (err *taskRunError) Error() string {
|
||||
return fmt.Sprintf(`task: Failed to run task "%s": %v`, err.taskName, err.err)
|
||||
func (err *TaskRunError) Error() string {
|
||||
return fmt.Sprintf(`task: Failed to run task %q: %v`, err.taskName, err.err)
|
||||
}
|
||||
|
||||
type cyclicDepError struct {
|
||||
taskName string
|
||||
}
|
||||
func (err *TaskRunError) ExitCode() int {
|
||||
if c, ok := interp.IsExitStatus(err.err); ok {
|
||||
return int(c)
|
||||
}
|
||||
|
||||
func (err *cyclicDepError) Error() string {
|
||||
return fmt.Sprintf(`task: Cyclic dependency of task "%s" detected`, err.taskName)
|
||||
}
|
||||
|
||||
type cantWatchNoSourcesError struct {
|
||||
taskName string
|
||||
}
|
||||
|
||||
func (err *cantWatchNoSourcesError) Error() string {
|
||||
return fmt.Sprintf(`task: Can't watch task "%s" because it has no specified sources`, err.taskName)
|
||||
}
|
||||
|
||||
type dynamicVarError struct {
|
||||
cause error
|
||||
cmd string
|
||||
}
|
||||
|
||||
func (err *dynamicVarError) Error() string {
|
||||
return fmt.Sprintf(`task: Command "%s" in taskvars file failed: %s`, err.cmd, err.cause)
|
||||
return 1
|
||||
}
|
||||
|
||||
// MaximumTaskCallExceededError is returned when a task is called too
|
||||
@@ -69,7 +73,7 @@ type MaximumTaskCallExceededError struct {
|
||||
|
||||
func (e *MaximumTaskCallExceededError) Error() string {
|
||||
return fmt.Sprintf(
|
||||
`task: maximum task call exceeded (%d) for task "%s": probably an cyclic dep or infinite loop`,
|
||||
`task: maximum task call exceeded (%d) for task %q: probably an cyclic dep or infinite loop`,
|
||||
MaximumTaskCall,
|
||||
e.task,
|
||||
)
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
hello:
|
||||
cmds:
|
||||
- echo "I am going to write a file named 'output.txt' now."
|
||||
- echo "hello" > output.txt
|
||||
generates:
|
||||
- output.txt
|
||||
@@ -1,52 +0,0 @@
|
||||
package execext
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"mvdan.cc/sh/interp"
|
||||
"mvdan.cc/sh/syntax"
|
||||
)
|
||||
|
||||
// RunCommandOptions is the options for the RunCommand func
|
||||
type RunCommandOptions struct {
|
||||
Context context.Context
|
||||
Command string
|
||||
Dir string
|
||||
Env []string
|
||||
Stdin io.Reader
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
}
|
||||
|
||||
var (
|
||||
// ErrNilOptions is returned when a nil options is given
|
||||
ErrNilOptions = errors.New("execext: nil options given")
|
||||
)
|
||||
|
||||
// RunCommand runs a shell command
|
||||
func RunCommand(opts *RunCommandOptions) error {
|
||||
if opts == nil {
|
||||
return ErrNilOptions
|
||||
}
|
||||
|
||||
p, err := syntax.NewParser().Parse(strings.NewReader(opts.Command), "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r := interp.Runner{
|
||||
Context: opts.Context,
|
||||
Dir: opts.Dir,
|
||||
Env: opts.Env,
|
||||
Stdin: opts.Stdin,
|
||||
Stdout: opts.Stdout,
|
||||
Stderr: opts.Stderr,
|
||||
}
|
||||
if err = r.Reset(); err != nil {
|
||||
return err
|
||||
}
|
||||
return r.Run(p)
|
||||
}
|
||||
29
go.mod
Normal file
29
go.mod
Normal file
@@ -0,0 +1,29 @@
|
||||
module github.com/go-task/task/v3
|
||||
|
||||
require (
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
|
||||
github.com/joho/godotenv v1.4.0
|
||||
github.com/mattn/go-zglob v0.0.4
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/sajari/fuzzy v1.0.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.8.1
|
||||
golang.org/x/exp v0.0.0-20220930202632-ec3f01382ef9
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
mvdan.cc/sh/v3 v3.6.0-0.dev.0.20220704111049-a6e3029cd899
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.9 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
)
|
||||
|
||||
go 1.18
|
||||
60
go.sum
Normal file
60
go.sum
Normal file
@@ -0,0 +1,60 @@
|
||||
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzPPUss=
|
||||
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/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
|
||||
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-zglob v0.0.4 h1:LQi2iOm0/fGgu80AioIJ/1j9w9Oh+9DZ39J4VAGzHQM=
|
||||
github.com/mattn/go-zglob v0.0.4/go.mod h1:MxxjyoXXnMxfIpxTK2GAkw1w8glPsQILx3N5wrKakiY=
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
|
||||
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/radovskyb/watcher v1.0.7 h1:AYePLih6dpmS32vlHfhCeli8127LzkIgwJGcwwe8tUE=
|
||||
github.com/radovskyb/watcher v1.0.7/go.mod h1:78okwvY5wPdzcb1UYnip1pvrZNIVEIh/Cm+ZuvsUYIg=
|
||||
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
|
||||
github.com/sajari/fuzzy v1.0.0 h1:+FmwVvJErsd0d0hAPlj4CxqxUtQY/fOoY0DwX4ykpRY=
|
||||
github.com/sajari/fuzzy v1.0.0/go.mod h1:OjYR6KxoWOe9+dOlXeiCJd4dIbED4Oo8wpS89o0pwOo=
|
||||
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
golang.org/x/exp v0.0.0-20220930202632-ec3f01382ef9 h1:RjggHMcaTVp0LOVZcW0bo8alwHrOaCrGUDgfWUHhnN4=
|
||||
golang.org/x/exp v0.0.0-20220930202632-ec3f01382ef9/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
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/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
mvdan.cc/sh/v3 v3.6.0-0.dev.0.20220704111049-a6e3029cd899 h1:nwm4t5PtLlFd/H342GP50CtYf7vyMCOZkPx3g9shO0c=
|
||||
mvdan.cc/sh/v3 v3.6.0-0.dev.0.20220704111049-a6e3029cd899/go.mod h1:1JcoyAKm1lZw/2bZje/iYKWicU/KMd0rsyJeKHnsK4E=
|
||||
28
hash.go
Normal file
28
hash.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-task/task/v3/internal/hash"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
func (e *Executor) GetHash(t *taskfile.Task) (string, error) {
|
||||
r := t.Run
|
||||
if r == "" {
|
||||
r = e.Taskfile.Run
|
||||
}
|
||||
|
||||
var h hash.HashFunc
|
||||
switch r {
|
||||
case "always":
|
||||
h = hash.Empty
|
||||
case "once":
|
||||
h = hash.Name
|
||||
case "when_changed":
|
||||
h = hash.Hash
|
||||
default:
|
||||
return "", fmt.Errorf(`task: invalid run "%s"`, r)
|
||||
}
|
||||
return h(t)
|
||||
}
|
||||
64
help.go
64
help.go
@@ -2,32 +2,70 @@ package task
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/go-task/task/v3/internal/logger"
|
||||
)
|
||||
|
||||
// PrintTasksHelp prints help os tasks that have a description
|
||||
func (e *Executor) PrintTasksHelp() {
|
||||
tasks := e.tasksWithDesc()
|
||||
// ListTasks prints a list of tasks.
|
||||
// Tasks that match the given filters will be excluded from the list.
|
||||
// The function returns a boolean indicating whether or not tasks were found.
|
||||
func (e *Executor) ListTasks(filters ...FilterFunc) bool {
|
||||
tasks := e.GetTaskList(filters...)
|
||||
if len(tasks) == 0 {
|
||||
return
|
||||
return false
|
||||
}
|
||||
e.println("Available tasks for this project:")
|
||||
e.Logger.Outf(logger.Default, "task: Available tasks for this project:")
|
||||
|
||||
// Format in tab-separated columns with a tab stop of 8.
|
||||
w := tabwriter.NewWriter(e.Stdout, 0, 8, 0, '\t', 0)
|
||||
w := tabwriter.NewWriter(e.Stdout, 0, 8, 6, ' ', 0)
|
||||
for _, task := range tasks {
|
||||
fmt.Fprintln(w, fmt.Sprintf("* %s:\t%s", task, e.Tasks[task].Desc))
|
||||
e.Logger.FOutf(w, logger.Yellow, "* ")
|
||||
e.Logger.FOutf(w, logger.Green, task.Task)
|
||||
e.Logger.FOutf(w, logger.Default, ": \t%s", task.Desc)
|
||||
if len(task.Aliases) > 0 {
|
||||
e.Logger.FOutf(w, logger.Cyan, "\t(aliases: %s)", strings.Join(task.Aliases, ", "))
|
||||
}
|
||||
fmt.Fprint(w, "\n")
|
||||
}
|
||||
w.Flush()
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Executor) tasksWithDesc() (tasks []string) {
|
||||
for name, task := range e.Tasks {
|
||||
if task.Desc != "" {
|
||||
tasks = append(tasks, name)
|
||||
// ListTaskNames prints only the task names in a Taskfile.
|
||||
// Only tasks with a non-empty description are printed if allTasks is false.
|
||||
// Otherwise, all task names are printed.
|
||||
func (e *Executor) ListTaskNames(allTasks bool) {
|
||||
// if called from cmd/task.go, e.Taskfile has not yet been parsed
|
||||
if e.Taskfile == nil {
|
||||
if err := e.readTaskfile(); err != nil {
|
||||
log.Fatal(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
sort.Strings(tasks)
|
||||
return
|
||||
// use stdout if no output defined
|
||||
var w io.Writer = os.Stdout
|
||||
if e.Stdout != nil {
|
||||
w = e.Stdout
|
||||
}
|
||||
// create a string slice from all map values (*taskfile.Task)
|
||||
s := make([]string, 0, len(e.Taskfile.Tasks))
|
||||
for _, t := range e.Taskfile.Tasks {
|
||||
if (allTasks || t.Desc != "") && !t.Internal {
|
||||
s = append(s, strings.TrimRight(t.Task, ":"))
|
||||
for _, alias := range t.Aliases {
|
||||
s = append(s, strings.TrimRight(alias, ":"))
|
||||
}
|
||||
}
|
||||
}
|
||||
// sort and print all task names
|
||||
sort.Strings(s)
|
||||
for _, t := range s {
|
||||
fmt.Fprintln(w, t)
|
||||
}
|
||||
}
|
||||
|
||||
35
init.go
35
init.go
@@ -3,31 +3,36 @@ package task
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/go-task/task/v3/internal/filepathext"
|
||||
)
|
||||
|
||||
const defaultTaskfile = `# github.com/go-task/task
|
||||
const defaultTaskfile = `# https://taskfile.dev
|
||||
|
||||
default:
|
||||
cmds:
|
||||
- echo "Hello, World!"
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
GREETING: Hello, World!
|
||||
|
||||
tasks:
|
||||
default:
|
||||
cmds:
|
||||
- echo "{{.GREETING}}"
|
||||
silent: true
|
||||
`
|
||||
|
||||
// InitTaskfile Taskfile creates a new Taskfile
|
||||
func InitTaskfile(w io.Writer, path string) error {
|
||||
for _, f := range []string{"Taskfile.yml", "Taskfile.toml", "Taskfile.json"} {
|
||||
f = filepath.Join(path, f)
|
||||
if _, err := os.Stat(f); err == nil {
|
||||
return ErrTaskfileAlreadyExists
|
||||
}
|
||||
func InitTaskfile(w io.Writer, dir string) error {
|
||||
f := filepathext.SmartJoin(dir, "Taskfile.yaml")
|
||||
|
||||
if _, err := os.Stat(f); err == nil {
|
||||
return ErrTaskfileAlreadyExists
|
||||
}
|
||||
|
||||
f := filepath.Join(path, "Taskfile.yml")
|
||||
if err := ioutil.WriteFile(f, []byte(defaultTaskfile), 0666); err != nil {
|
||||
if err := os.WriteFile(f, []byte(defaultTaskfile), 0o644); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(w, "Taskfile.yml created in the current directory\n")
|
||||
fmt.Fprintf(w, "Taskfile.yaml created in the current directory\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
387
install-task.sh
Executable file
387
install-task.sh
Executable file
@@ -0,0 +1,387 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
# Code generated by godownloader on 2021-01-12T13:40:40Z. DO NOT EDIT.
|
||||
#
|
||||
|
||||
usage() {
|
||||
this=$1
|
||||
cat <<EOF
|
||||
$this: download go binaries for go-task/task
|
||||
|
||||
Usage: $this [-b] bindir [-d] [tag]
|
||||
-b sets bindir or installation directory, Defaults to ./bin
|
||||
-d turns on debug logging
|
||||
[tag] is a tag from
|
||||
https://github.com/go-task/task/releases
|
||||
If tag is missing, then the latest will be used.
|
||||
|
||||
Generated by godownloader
|
||||
https://github.com/goreleaser/godownloader
|
||||
|
||||
EOF
|
||||
exit 2
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
#BINDIR is ./bin unless set be ENV
|
||||
# over-ridden by flag below
|
||||
|
||||
BINDIR=${BINDIR:-./bin}
|
||||
while getopts "b:dh?x" arg; do
|
||||
case "$arg" in
|
||||
b) BINDIR="$OPTARG" ;;
|
||||
d) log_set_priority 10 ;;
|
||||
h | \?) usage "$0" ;;
|
||||
x) set -x ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
TAG=$1
|
||||
}
|
||||
# this function wraps all the destructive operations
|
||||
# if a curl|bash cuts off the end of the script due to
|
||||
# network, either nothing will happen or will syntax error
|
||||
# out preventing half-done work
|
||||
execute() {
|
||||
tmpdir=$(mktemp -d)
|
||||
log_debug "downloading files into ${tmpdir}"
|
||||
http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}"
|
||||
http_download "${tmpdir}/${CHECKSUM}" "${CHECKSUM_URL}"
|
||||
hash_sha256_verify "${tmpdir}/${TARBALL}" "${tmpdir}/${CHECKSUM}"
|
||||
srcdir="${tmpdir}"
|
||||
(cd "${tmpdir}" && untar "${TARBALL}")
|
||||
test ! -d "${BINDIR}" && install -d "${BINDIR}"
|
||||
for binexe in $BINARIES; do
|
||||
if [ "$OS" = "windows" ]; then
|
||||
binexe="${binexe}.exe"
|
||||
fi
|
||||
install "${srcdir}/${binexe}" "${BINDIR}/"
|
||||
log_info "installed ${BINDIR}/${binexe}"
|
||||
done
|
||||
rm -rf "${tmpdir}"
|
||||
}
|
||||
get_binaries() {
|
||||
case "$PLATFORM" in
|
||||
darwin/amd64) BINARIES="task" ;;
|
||||
darwin/arm64) BINARIES="task" ;;
|
||||
darwin/armv5) BINARIES="task" ;;
|
||||
darwin/armv6) BINARIES="task" ;;
|
||||
darwin/armv7) BINARIES="task" ;;
|
||||
linux/386) BINARIES="task" ;;
|
||||
linux/amd64) BINARIES="task" ;;
|
||||
linux/arm64) BINARIES="task" ;;
|
||||
linux/armv5) BINARIES="task" ;;
|
||||
linux/armv6) BINARIES="task" ;;
|
||||
linux/armv7) BINARIES="task" ;;
|
||||
windows/386) BINARIES="task" ;;
|
||||
windows/amd64) BINARIES="task" ;;
|
||||
windows/arm64) BINARIES="task" ;;
|
||||
windows/armv5) BINARIES="task" ;;
|
||||
windows/armv6) BINARIES="task" ;;
|
||||
windows/armv7) BINARIES="task" ;;
|
||||
*)
|
||||
log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
tag_to_version() {
|
||||
if [ -z "${TAG}" ]; then
|
||||
log_info "checking GitHub for latest tag"
|
||||
else
|
||||
log_info "checking GitHub for tag '${TAG}'"
|
||||
fi
|
||||
REALTAG=$(github_release "$OWNER/$REPO" "${TAG}") && true
|
||||
if test -z "$REALTAG"; then
|
||||
log_crit "unable to find '${TAG}' - use 'latest' or see https://github.com/${PREFIX}/releases for details"
|
||||
exit 1
|
||||
fi
|
||||
# if version starts with 'v', remove it
|
||||
TAG="$REALTAG"
|
||||
VERSION=${TAG#v}
|
||||
}
|
||||
adjust_format() {
|
||||
# change format (tar.gz or zip) based on OS
|
||||
case ${OS} in
|
||||
windows) FORMAT=zip ;;
|
||||
esac
|
||||
true
|
||||
}
|
||||
adjust_os() {
|
||||
# adjust archive name based on OS
|
||||
true
|
||||
}
|
||||
adjust_arch() {
|
||||
# adjust archive name based on ARCH
|
||||
true
|
||||
}
|
||||
|
||||
cat /dev/null <<EOF
|
||||
------------------------------------------------------------------------
|
||||
https://github.com/client9/shlib - portable posix shell functions
|
||||
Public domain - http://unlicense.org
|
||||
https://github.com/client9/shlib/blob/master/LICENSE.md
|
||||
but credit (and pull requests) appreciated.
|
||||
------------------------------------------------------------------------
|
||||
EOF
|
||||
is_command() {
|
||||
command -v "$1" >/dev/null
|
||||
}
|
||||
echoerr() {
|
||||
echo "$@" 1>&2
|
||||
}
|
||||
log_prefix() {
|
||||
echo "$0"
|
||||
}
|
||||
_logp=6
|
||||
log_set_priority() {
|
||||
_logp="$1"
|
||||
}
|
||||
log_priority() {
|
||||
if test -z "$1"; then
|
||||
echo "$_logp"
|
||||
return
|
||||
fi
|
||||
[ "$1" -le "$_logp" ]
|
||||
}
|
||||
log_tag() {
|
||||
case $1 in
|
||||
0) echo "emerg" ;;
|
||||
1) echo "alert" ;;
|
||||
2) echo "crit" ;;
|
||||
3) echo "err" ;;
|
||||
4) echo "warning" ;;
|
||||
5) echo "notice" ;;
|
||||
6) echo "info" ;;
|
||||
7) echo "debug" ;;
|
||||
*) echo "$1" ;;
|
||||
esac
|
||||
}
|
||||
log_debug() {
|
||||
log_priority 7 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 7)" "$@"
|
||||
}
|
||||
log_info() {
|
||||
log_priority 6 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 6)" "$@"
|
||||
}
|
||||
log_err() {
|
||||
log_priority 3 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 3)" "$@"
|
||||
}
|
||||
log_crit() {
|
||||
log_priority 2 || return 0
|
||||
echoerr "$(log_prefix)" "$(log_tag 2)" "$@"
|
||||
}
|
||||
uname_os() {
|
||||
os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
case "$os" in
|
||||
cygwin_nt*) os="windows" ;;
|
||||
mingw*) os="windows" ;;
|
||||
msys_nt*) os="windows" ;;
|
||||
esac
|
||||
echo "$os"
|
||||
}
|
||||
uname_arch() {
|
||||
arch=$(uname -m)
|
||||
case $arch in
|
||||
x86_64) arch="amd64" ;;
|
||||
x86) arch="386" ;;
|
||||
i686) arch="386" ;;
|
||||
i386) arch="386" ;;
|
||||
aarch64) arch="arm64" ;;
|
||||
armv5*) arch="arm" ;;
|
||||
armv6*) arch="arm" ;;
|
||||
armv7*) arch="arm" ;;
|
||||
esac
|
||||
echo ${arch}
|
||||
}
|
||||
uname_os_check() {
|
||||
os=$(uname_os)
|
||||
case "$os" in
|
||||
darwin) return 0 ;;
|
||||
dragonfly) return 0 ;;
|
||||
freebsd) return 0 ;;
|
||||
linux) return 0 ;;
|
||||
android) return 0 ;;
|
||||
nacl) return 0 ;;
|
||||
netbsd) return 0 ;;
|
||||
openbsd) return 0 ;;
|
||||
plan9) return 0 ;;
|
||||
solaris) return 0 ;;
|
||||
windows) return 0 ;;
|
||||
esac
|
||||
log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
|
||||
return 1
|
||||
}
|
||||
uname_arch_check() {
|
||||
arch=$(uname_arch)
|
||||
case "$arch" in
|
||||
386) return 0 ;;
|
||||
amd64) return 0 ;;
|
||||
arm64) return 0 ;;
|
||||
arm) return 0 ;;
|
||||
ppc64) return 0 ;;
|
||||
ppc64le) return 0 ;;
|
||||
mips) return 0 ;;
|
||||
mipsle) return 0 ;;
|
||||
mips64) return 0 ;;
|
||||
mips64le) return 0 ;;
|
||||
s390x) return 0 ;;
|
||||
amd64p32) return 0 ;;
|
||||
esac
|
||||
log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
|
||||
return 1
|
||||
}
|
||||
untar() {
|
||||
tarball=$1
|
||||
case "${tarball}" in
|
||||
*.tar.gz | *.tgz) tar --no-same-owner -xzf "${tarball}" ;;
|
||||
*.tar) tar --no-same-owner -xf "${tarball}" ;;
|
||||
*.zip) unzip "${tarball}" ;;
|
||||
*)
|
||||
log_err "untar unknown archive format for ${tarball}"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
http_download_curl() {
|
||||
local_file=$1
|
||||
source_url=$2
|
||||
header=$3
|
||||
if [ -z "$header" ]; then
|
||||
code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
|
||||
else
|
||||
code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
|
||||
fi
|
||||
if [ "$code" != "200" ]; then
|
||||
log_debug "http_download_curl received HTTP status $code"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
http_download_wget() {
|
||||
local_file=$1
|
||||
source_url=$2
|
||||
header=$3
|
||||
if [ -z "$header" ]; then
|
||||
wget -q -O "$local_file" "$source_url"
|
||||
else
|
||||
wget -q --header "$header" -O "$local_file" "$source_url"
|
||||
fi
|
||||
}
|
||||
http_download() {
|
||||
log_debug "http_download $2"
|
||||
if is_command curl; then
|
||||
http_download_curl "$@"
|
||||
return
|
||||
elif is_command wget; then
|
||||
http_download_wget "$@"
|
||||
return
|
||||
fi
|
||||
log_crit "http_download unable to find wget or curl"
|
||||
return 1
|
||||
}
|
||||
http_copy() {
|
||||
tmp=$(mktemp)
|
||||
http_download "${tmp}" "$1" "$2" || return 1
|
||||
body=$(cat "$tmp")
|
||||
rm -f "${tmp}"
|
||||
echo "$body"
|
||||
}
|
||||
github_release() {
|
||||
owner_repo=$1
|
||||
version=$2
|
||||
test -z "$version" && version="latest"
|
||||
giturl="https://github.com/${owner_repo}/releases/${version}"
|
||||
json=$(http_copy "$giturl" "Accept:application/json")
|
||||
test -z "$json" && return 1
|
||||
version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
|
||||
test -z "$version" && return 1
|
||||
echo "$version"
|
||||
}
|
||||
hash_sha256() {
|
||||
TARGET=${1:-/dev/stdin}
|
||||
if is_command gsha256sum; then
|
||||
hash=$(gsha256sum "$TARGET") || return 1
|
||||
echo "$hash" | cut -d ' ' -f 1
|
||||
elif is_command sha256sum; then
|
||||
hash=$(sha256sum "$TARGET") || return 1
|
||||
echo "$hash" | cut -d ' ' -f 1
|
||||
elif is_command shasum; then
|
||||
hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1
|
||||
echo "$hash" | cut -d ' ' -f 1
|
||||
elif is_command openssl; then
|
||||
hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1
|
||||
echo "$hash" | cut -d ' ' -f a
|
||||
else
|
||||
log_crit "hash_sha256 unable to find command to compute sha-256 hash"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
hash_sha256_verify() {
|
||||
TARGET=$1
|
||||
checksums=$2
|
||||
if [ -z "$checksums" ]; then
|
||||
log_err "hash_sha256_verify checksum file not specified in arg2"
|
||||
return 1
|
||||
fi
|
||||
BASENAME=${TARGET##*/}
|
||||
want=$(grep "${BASENAME}" "${checksums}" 2>/dev/null | tr '\t' ' ' | cut -d ' ' -f 1)
|
||||
if [ -z "$want" ]; then
|
||||
log_err "hash_sha256_verify unable to find checksum for '${TARGET}' in '${checksums}'"
|
||||
return 1
|
||||
fi
|
||||
got=$(hash_sha256 "$TARGET")
|
||||
if [ "$want" != "$got" ]; then
|
||||
log_err "hash_sha256_verify checksum for '$TARGET' did not verify ${want} vs $got"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
cat /dev/null <<EOF
|
||||
------------------------------------------------------------------------
|
||||
End of functions from https://github.com/client9/shlib
|
||||
------------------------------------------------------------------------
|
||||
EOF
|
||||
|
||||
PROJECT_NAME="task"
|
||||
OWNER=go-task
|
||||
REPO="task"
|
||||
BINARY=task
|
||||
FORMAT=tar.gz
|
||||
OS=$(uname_os)
|
||||
ARCH=$(uname_arch)
|
||||
PREFIX="$OWNER/$REPO"
|
||||
|
||||
# use in logging routines
|
||||
log_prefix() {
|
||||
echo "$PREFIX"
|
||||
}
|
||||
PLATFORM="${OS}/${ARCH}"
|
||||
GITHUB_DOWNLOAD=https://github.com/${OWNER}/${REPO}/releases/download
|
||||
|
||||
uname_os_check "$OS"
|
||||
uname_arch_check "$ARCH"
|
||||
|
||||
parse_args "$@"
|
||||
|
||||
get_binaries
|
||||
|
||||
tag_to_version
|
||||
|
||||
adjust_format
|
||||
|
||||
adjust_os
|
||||
|
||||
adjust_arch
|
||||
|
||||
log_info "found version: ${VERSION} for ${TAG}/${OS}/${ARCH}"
|
||||
|
||||
NAME=${BINARY}_${OS}_${ARCH}
|
||||
TARBALL=${NAME}.${FORMAT}
|
||||
TARBALL_URL=${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}
|
||||
CHECKSUM=task_checksums.txt
|
||||
CHECKSUM_URL=${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUM}
|
||||
|
||||
|
||||
execute
|
||||
15
internal/compiler/compiler.go
Normal file
15
internal/compiler/compiler.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
// Compiler handles compilation of a task before its execution.
|
||||
// E.g. variable merger, template processing, etc.
|
||||
type Compiler interface {
|
||||
GetTaskfileVariables() (*taskfile.Vars, error)
|
||||
GetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error)
|
||||
FastGetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error)
|
||||
HandleDynamicVar(v taskfile.Var, dir string) (string, error)
|
||||
ResetCache()
|
||||
}
|
||||
20
internal/compiler/env.go
Normal file
20
internal/compiler/env.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
// GetEnviron the all return all environment variables encapsulated on a
|
||||
// taskfile.Vars
|
||||
func GetEnviron() *taskfile.Vars {
|
||||
m := &taskfile.Vars{}
|
||||
for _, e := range os.Environ() {
|
||||
keyVal := strings.SplitN(e, "=", 2)
|
||||
key, val := keyVal[0], keyVal[1]
|
||||
m.Set(key, taskfile.Var{Static: val})
|
||||
}
|
||||
return m
|
||||
}
|
||||
131
internal/compiler/v2/compiler_v2.go
Normal file
131
internal/compiler/v2/compiler_v2.go
Normal file
@@ -0,0 +1,131 @@
|
||||
package v2
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/go-task/task/v3/internal/compiler"
|
||||
"github.com/go-task/task/v3/internal/execext"
|
||||
"github.com/go-task/task/v3/internal/logger"
|
||||
"github.com/go-task/task/v3/internal/templater"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
var _ compiler.Compiler = &CompilerV2{}
|
||||
|
||||
type CompilerV2 struct {
|
||||
Dir string
|
||||
|
||||
Taskvars *taskfile.Vars
|
||||
TaskfileVars *taskfile.Vars
|
||||
|
||||
Expansions int
|
||||
|
||||
Logger *logger.Logger
|
||||
|
||||
dynamicCache map[string]string
|
||||
muDynamicCache sync.Mutex
|
||||
}
|
||||
|
||||
func (c *CompilerV2) GetTaskfileVariables() (*taskfile.Vars, error) {
|
||||
return &taskfile.Vars{}, nil
|
||||
}
|
||||
|
||||
// FastGetVariables is a no-op on v2
|
||||
func (c *CompilerV2) FastGetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error) {
|
||||
return c.GetVariables(t, call)
|
||||
}
|
||||
|
||||
// GetVariables returns fully resolved variables following the priority order:
|
||||
// 1. Task variables
|
||||
// 2. Call variables
|
||||
// 3. Taskfile variables
|
||||
// 4. Taskvars file variables
|
||||
// 5. Environment variables
|
||||
func (c *CompilerV2) GetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error) {
|
||||
vr := varResolver{
|
||||
c: c,
|
||||
vars: compiler.GetEnviron(),
|
||||
}
|
||||
vr.vars.Set("TASK", taskfile.Var{Static: t.Task})
|
||||
|
||||
for _, vars := range []*taskfile.Vars{c.Taskvars, c.TaskfileVars, call.Vars, t.Vars} {
|
||||
for i := 0; i < c.Expansions; i++ {
|
||||
vr.merge(vars)
|
||||
}
|
||||
}
|
||||
return vr.vars, vr.err
|
||||
}
|
||||
|
||||
type varResolver struct {
|
||||
c *CompilerV2
|
||||
vars *taskfile.Vars
|
||||
err error
|
||||
}
|
||||
|
||||
func (vr *varResolver) merge(vars *taskfile.Vars) {
|
||||
if vr.err != nil {
|
||||
return
|
||||
}
|
||||
tr := templater.Templater{Vars: vr.vars}
|
||||
_ = vars.Range(func(k string, v taskfile.Var) error {
|
||||
v = taskfile.Var{
|
||||
Static: tr.Replace(v.Static),
|
||||
Sh: tr.Replace(v.Sh),
|
||||
}
|
||||
static, err := vr.c.HandleDynamicVar(v, "")
|
||||
if err != nil {
|
||||
vr.err = err
|
||||
return err
|
||||
}
|
||||
vr.vars.Set(k, taskfile.Var{Static: static})
|
||||
return nil
|
||||
})
|
||||
vr.err = tr.Err()
|
||||
}
|
||||
|
||||
func (c *CompilerV2) HandleDynamicVar(v taskfile.Var, _ string) (string, error) {
|
||||
if v.Static != "" || v.Sh == "" {
|
||||
return v.Static, nil
|
||||
}
|
||||
|
||||
c.muDynamicCache.Lock()
|
||||
defer c.muDynamicCache.Unlock()
|
||||
|
||||
if c.dynamicCache == nil {
|
||||
c.dynamicCache = make(map[string]string, 30)
|
||||
}
|
||||
if result, ok := c.dynamicCache[v.Sh]; ok {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
var stdout bytes.Buffer
|
||||
opts := &execext.RunCommandOptions{
|
||||
Command: v.Sh,
|
||||
Stdout: &stdout,
|
||||
Stderr: c.Logger.Stderr,
|
||||
}
|
||||
if err := execext.RunCommand(context.Background(), opts); err != nil {
|
||||
return "", fmt.Errorf(`task: Command "%s" failed: %s`, opts.Command, err)
|
||||
}
|
||||
|
||||
// Trim a single trailing newline from the result to make most command
|
||||
// output easier to use in shell commands.
|
||||
result := strings.TrimSuffix(stdout.String(), "\n")
|
||||
|
||||
c.dynamicCache[v.Sh] = result
|
||||
c.Logger.VerboseErrf(logger.Magenta, `task: dynamic variable: '%s' result: '%s'`, v.Sh, result)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ResetCache clear the dymanic variables cache
|
||||
func (c *CompilerV2) ResetCache() {
|
||||
c.muDynamicCache.Lock()
|
||||
defer c.muDynamicCache.Unlock()
|
||||
|
||||
c.dynamicCache = nil
|
||||
}
|
||||
193
internal/compiler/v3/compiler_v3.go
Normal file
193
internal/compiler/v3/compiler_v3.go
Normal file
@@ -0,0 +1,193 @@
|
||||
package v3
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/go-task/task/v3/internal/compiler"
|
||||
"github.com/go-task/task/v3/internal/execext"
|
||||
"github.com/go-task/task/v3/internal/filepathext"
|
||||
"github.com/go-task/task/v3/internal/logger"
|
||||
"github.com/go-task/task/v3/internal/templater"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
var _ compiler.Compiler = &CompilerV3{}
|
||||
|
||||
type CompilerV3 struct {
|
||||
Dir string
|
||||
|
||||
TaskfileEnv *taskfile.Vars
|
||||
TaskfileVars *taskfile.Vars
|
||||
|
||||
Logger *logger.Logger
|
||||
|
||||
dynamicCache map[string]string
|
||||
muDynamicCache sync.Mutex
|
||||
}
|
||||
|
||||
func (c *CompilerV3) GetTaskfileVariables() (*taskfile.Vars, error) {
|
||||
return c.getVariables(nil, nil, true)
|
||||
}
|
||||
|
||||
func (c *CompilerV3) GetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error) {
|
||||
return c.getVariables(t, &call, true)
|
||||
}
|
||||
|
||||
func (c *CompilerV3) FastGetVariables(t *taskfile.Task, call taskfile.Call) (*taskfile.Vars, error) {
|
||||
return c.getVariables(t, &call, false)
|
||||
}
|
||||
|
||||
func (c *CompilerV3) getVariables(t *taskfile.Task, call *taskfile.Call, evaluateShVars bool) (*taskfile.Vars, error) {
|
||||
result := compiler.GetEnviron()
|
||||
if t != nil {
|
||||
specialVars, err := c.getSpecialVars(t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for k, v := range specialVars {
|
||||
result.Set(k, taskfile.Var{Static: v})
|
||||
}
|
||||
}
|
||||
|
||||
getRangeFunc := func(dir string) func(k string, v taskfile.Var) error {
|
||||
return func(k string, v taskfile.Var) error {
|
||||
tr := templater.Templater{Vars: result, RemoveNoValue: true}
|
||||
|
||||
if !evaluateShVars {
|
||||
result.Set(k, taskfile.Var{Static: tr.Replace(v.Static)})
|
||||
return nil
|
||||
}
|
||||
|
||||
v = taskfile.Var{
|
||||
Static: tr.Replace(v.Static),
|
||||
Sh: tr.Replace(v.Sh),
|
||||
Dir: v.Dir,
|
||||
}
|
||||
if err := tr.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
static, err := c.HandleDynamicVar(v, dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result.Set(k, taskfile.Var{Static: static})
|
||||
return nil
|
||||
}
|
||||
}
|
||||
rangeFunc := getRangeFunc(c.Dir)
|
||||
|
||||
var taskRangeFunc func(k string, v taskfile.Var) error
|
||||
if t != nil {
|
||||
// NOTE(@andreynering): We're manually joining these paths here because
|
||||
// this is the raw task, not the compiled one.
|
||||
tr := templater.Templater{Vars: result, RemoveNoValue: true}
|
||||
dir := tr.Replace(t.Dir)
|
||||
if err := tr.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dir = filepathext.SmartJoin(c.Dir, dir)
|
||||
taskRangeFunc = getRangeFunc(dir)
|
||||
}
|
||||
|
||||
if err := c.TaskfileEnv.Range(rangeFunc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := c.TaskfileVars.Range(rangeFunc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if t != nil {
|
||||
if err := t.IncludedTaskfileVars.Range(taskRangeFunc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := t.IncludeVars.Range(rangeFunc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if t == nil || call == nil {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
if err := call.Vars.Range(rangeFunc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := t.Vars.Range(taskRangeFunc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (c *CompilerV3) HandleDynamicVar(v taskfile.Var, dir string) (string, error) {
|
||||
if v.Static != "" || v.Sh == "" {
|
||||
return v.Static, nil
|
||||
}
|
||||
|
||||
c.muDynamicCache.Lock()
|
||||
defer c.muDynamicCache.Unlock()
|
||||
|
||||
if c.dynamicCache == nil {
|
||||
c.dynamicCache = make(map[string]string, 30)
|
||||
}
|
||||
if result, ok := c.dynamicCache[v.Sh]; ok {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// NOTE(@andreynering): If a var have a specific dir, use this instead
|
||||
if v.Dir != "" {
|
||||
dir = v.Dir
|
||||
}
|
||||
|
||||
var stdout bytes.Buffer
|
||||
opts := &execext.RunCommandOptions{
|
||||
Command: v.Sh,
|
||||
Dir: dir,
|
||||
Stdout: &stdout,
|
||||
Stderr: c.Logger.Stderr,
|
||||
}
|
||||
if err := execext.RunCommand(context.Background(), opts); err != nil {
|
||||
return "", fmt.Errorf(`task: Command "%s" failed: %s`, opts.Command, err)
|
||||
}
|
||||
|
||||
// Trim a single trailing newline from the result to make most command
|
||||
// output easier to use in shell commands.
|
||||
result := strings.TrimSuffix(stdout.String(), "\r\n")
|
||||
result = strings.TrimSuffix(result, "\n")
|
||||
|
||||
c.dynamicCache[v.Sh] = result
|
||||
c.Logger.VerboseErrf(logger.Magenta, `task: dynamic variable: '%s' result: '%s'`, v.Sh, result)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ResetCache clear the dymanic variables cache
|
||||
func (c *CompilerV3) ResetCache() {
|
||||
c.muDynamicCache.Lock()
|
||||
defer c.muDynamicCache.Unlock()
|
||||
|
||||
c.dynamicCache = nil
|
||||
}
|
||||
|
||||
func (c *CompilerV3) getSpecialVars(t *taskfile.Task) (map[string]string, error) {
|
||||
taskfileDir, err := c.getTaskfileDir(t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return map[string]string{
|
||||
"TASK": t.Task,
|
||||
"ROOT_DIR": c.Dir,
|
||||
"TASKFILE_DIR": taskfileDir,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *CompilerV3) getTaskfileDir(t *taskfile.Task) (string, error) {
|
||||
if t.IncludedTaskfile != nil {
|
||||
return t.IncludedTaskfile.FullDirPath()
|
||||
}
|
||||
return c.Dir, nil
|
||||
}
|
||||
13
internal/execext/devnull.go
Normal file
13
internal/execext/devnull.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package execext
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
var _ io.ReadWriteCloser = devNull{}
|
||||
|
||||
type devNull struct{}
|
||||
|
||||
func (devNull) Read(p []byte) (int, error) { return 0, io.EOF }
|
||||
func (devNull) Write(p []byte) (int, error) { return len(p), nil }
|
||||
func (devNull) Close() error { return nil }
|
||||
113
internal/execext/exec.go
Normal file
113
internal/execext/exec.go
Normal file
@@ -0,0 +1,113 @@
|
||||
package execext
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"mvdan.cc/sh/v3/expand"
|
||||
"mvdan.cc/sh/v3/interp"
|
||||
"mvdan.cc/sh/v3/shell"
|
||||
"mvdan.cc/sh/v3/syntax"
|
||||
)
|
||||
|
||||
// RunCommandOptions is the options for the RunCommand func
|
||||
type RunCommandOptions struct {
|
||||
Command string
|
||||
Dir string
|
||||
Env []string
|
||||
Stdin io.Reader
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
}
|
||||
|
||||
var (
|
||||
// ErrNilOptions is returned when a nil options is given
|
||||
ErrNilOptions = errors.New("execext: nil options given")
|
||||
)
|
||||
|
||||
// RunCommand runs a shell command
|
||||
func RunCommand(ctx context.Context, opts *RunCommandOptions) error {
|
||||
if opts == nil {
|
||||
return ErrNilOptions
|
||||
}
|
||||
|
||||
p, err := syntax.NewParser().Parse(strings.NewReader(opts.Command), "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
environ := opts.Env
|
||||
if len(environ) == 0 {
|
||||
environ = os.Environ()
|
||||
}
|
||||
|
||||
r, err := interp.New(
|
||||
interp.Params("-e"),
|
||||
interp.Env(expand.ListEnviron(environ...)),
|
||||
interp.ExecHandler(interp.DefaultExecHandler(15*time.Second)),
|
||||
interp.OpenHandler(openHandler),
|
||||
interp.StdIO(opts.Stdin, opts.Stdout, opts.Stderr),
|
||||
dirOption(opts.Dir),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return r.Run(ctx, p)
|
||||
}
|
||||
|
||||
// IsExitError returns true the given error is an exis status error
|
||||
func IsExitError(err error) bool {
|
||||
if _, ok := interp.IsExitStatus(err); ok {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Expand is a helper to mvdan.cc/shell.Fields that returns the first field
|
||||
// if available.
|
||||
func Expand(s string) (string, error) {
|
||||
s = filepath.ToSlash(s)
|
||||
s = strings.ReplaceAll(s, " ", `\ `)
|
||||
fields, err := shell.Fields(s, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(fields) > 0 {
|
||||
return fields[0], nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func openHandler(ctx context.Context, path string, flag int, perm os.FileMode) (io.ReadWriteCloser, error) {
|
||||
if path == "/dev/null" {
|
||||
return devNull{}, nil
|
||||
}
|
||||
return interp.DefaultOpenHandler()(ctx, path, flag, perm)
|
||||
}
|
||||
|
||||
func dirOption(path string) interp.RunnerOption {
|
||||
return func(r *interp.Runner) error {
|
||||
err := interp.Dir(path)(r)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If the specified directory doesn't exist, it will be created later.
|
||||
// Therefore, even if `interp.Dir` method returns an error, the
|
||||
// directory path should be set only when the directory cannot be found.
|
||||
if absPath, _ := filepath.Abs(path); absPath != "" {
|
||||
if _, err := os.Stat(absPath); os.IsNotExist(err) {
|
||||
r.Dir = absPath
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
31
internal/filepathext/filepathext.go
Normal file
31
internal/filepathext/filepathext.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package filepathext
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// SmartJoin joins two paths, but only if the second is not already an
|
||||
// absolute path.
|
||||
func SmartJoin(a, b string) string {
|
||||
if filepath.IsAbs(b) {
|
||||
return b
|
||||
}
|
||||
return filepath.Join(a, b)
|
||||
}
|
||||
|
||||
// TryAbsToRel tries to convert an absolute path to relative based on the
|
||||
// process working directory. If it can't, it returns the absolute path.
|
||||
func TryAbsToRel(abs string) string {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return abs
|
||||
}
|
||||
|
||||
rel, err := filepath.Rel(wd, abs)
|
||||
if err != nil {
|
||||
return abs
|
||||
}
|
||||
|
||||
return rel
|
||||
}
|
||||
24
internal/hash/hash.go
Normal file
24
internal/hash/hash.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package hash
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/mitchellh/hashstructure/v2"
|
||||
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
type HashFunc func(*taskfile.Task) (string, error)
|
||||
|
||||
func Empty(*taskfile.Task) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func Name(t *taskfile.Task) (string, error) {
|
||||
return t.Task, nil
|
||||
}
|
||||
|
||||
func Hash(t *taskfile.Task) (string, error) {
|
||||
h, err := hashstructure.Hash(t, hashstructure.FormatV2, nil)
|
||||
return fmt.Sprintf("%s:%d", t.Task, h), err
|
||||
}
|
||||
95
internal/logger/logger.go
Normal file
95
internal/logger/logger.go
Normal file
@@ -0,0 +1,95 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
type Color func() PrintFunc
|
||||
type PrintFunc func(io.Writer, string, ...interface{})
|
||||
|
||||
func Default() PrintFunc {
|
||||
return color.New(envColor("TASK_COLOR_RESET", color.Reset)).FprintfFunc()
|
||||
}
|
||||
func Blue() PrintFunc {
|
||||
return color.New(envColor("TASK_COLOR_BLUE", color.FgBlue)).FprintfFunc()
|
||||
}
|
||||
func Green() PrintFunc {
|
||||
return color.New(envColor("TASK_COLOR_GREEN", color.FgGreen)).FprintfFunc()
|
||||
}
|
||||
func Cyan() PrintFunc {
|
||||
return color.New(envColor("TASK_COLOR_CYAN", color.FgCyan)).FprintfFunc()
|
||||
}
|
||||
func Yellow() PrintFunc {
|
||||
return color.New(envColor("TASK_COLOR_YELLOW", color.FgYellow)).FprintfFunc()
|
||||
}
|
||||
func Magenta() PrintFunc {
|
||||
return color.New(envColor("TASK_COLOR_MAGENTA", color.FgMagenta)).FprintfFunc()
|
||||
}
|
||||
func Red() PrintFunc {
|
||||
return color.New(envColor("TASK_COLOR_RED", color.FgRed)).FprintfFunc()
|
||||
}
|
||||
|
||||
func envColor(env string, defaultColor color.Attribute) color.Attribute {
|
||||
override, err := strconv.Atoi(os.Getenv(env))
|
||||
if err == nil {
|
||||
return color.Attribute(override)
|
||||
|
||||
}
|
||||
return defaultColor
|
||||
}
|
||||
|
||||
// Logger is just a wrapper that prints stuff to STDOUT or STDERR,
|
||||
// with optional color.
|
||||
type Logger struct {
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
Verbose bool
|
||||
Color bool
|
||||
}
|
||||
|
||||
// Outf prints stuff to STDOUT.
|
||||
func (l *Logger) Outf(color Color, s string, args ...interface{}) {
|
||||
l.FOutf(l.Stdout, color, s+"\n", args...)
|
||||
}
|
||||
|
||||
// FOutf prints stuff to the given writer.
|
||||
func (l *Logger) FOutf(w io.Writer, color Color, s string, args ...interface{}) {
|
||||
if len(args) == 0 {
|
||||
s, args = "%s", []interface{}{s}
|
||||
}
|
||||
if !l.Color {
|
||||
color = Default
|
||||
}
|
||||
print := color()
|
||||
print(w, s, args...)
|
||||
}
|
||||
|
||||
// VerboseOutf prints stuff to STDOUT if verbose mode is enabled.
|
||||
func (l *Logger) VerboseOutf(color Color, s string, args ...interface{}) {
|
||||
if l.Verbose {
|
||||
l.Outf(color, s, args...)
|
||||
}
|
||||
}
|
||||
|
||||
// Errf prints stuff to STDERR.
|
||||
func (l *Logger) Errf(color Color, s string, args ...interface{}) {
|
||||
if len(args) == 0 {
|
||||
s, args = "%s", []interface{}{s}
|
||||
}
|
||||
if !l.Color {
|
||||
color = Default
|
||||
}
|
||||
print := color()
|
||||
print(l.Stderr, s+"\n", args...)
|
||||
}
|
||||
|
||||
// VerboseErrf prints stuff to STDERR if verbose mode is enabled.
|
||||
func (l *Logger) VerboseErrf(color Color, s string, args ...interface{}) {
|
||||
if l.Verbose {
|
||||
l.Errf(color, s, args...)
|
||||
}
|
||||
}
|
||||
44
internal/output/group.go
Normal file
44
internal/output/group.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package output
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
)
|
||||
|
||||
type Group struct {
|
||||
Begin, End string
|
||||
}
|
||||
|
||||
func (g Group) WrapWriter(stdOut, _ io.Writer, _ string, tmpl Templater) (io.Writer, io.Writer, CloseFunc) {
|
||||
gw := &groupWriter{writer: stdOut}
|
||||
if g.Begin != "" {
|
||||
gw.begin = tmpl.Replace(g.Begin) + "\n"
|
||||
}
|
||||
if g.End != "" {
|
||||
gw.end = tmpl.Replace(g.End) + "\n"
|
||||
}
|
||||
return gw, gw, func() error { return gw.close() }
|
||||
}
|
||||
|
||||
type groupWriter struct {
|
||||
writer io.Writer
|
||||
buff bytes.Buffer
|
||||
begin, end string
|
||||
}
|
||||
|
||||
func (gw *groupWriter) Write(p []byte) (int, error) {
|
||||
return gw.buff.Write(p)
|
||||
}
|
||||
|
||||
func (gw *groupWriter) close() error {
|
||||
if gw.buff.Len() == 0 {
|
||||
// don't print begin/end messages if there's no buffered entries
|
||||
return nil
|
||||
}
|
||||
if _, err := io.WriteString(gw.writer, gw.begin); err != nil {
|
||||
return err
|
||||
}
|
||||
gw.buff.WriteString(gw.end)
|
||||
_, err := io.Copy(gw.writer, &gw.buff)
|
||||
return err
|
||||
}
|
||||
11
internal/output/interleaved.go
Normal file
11
internal/output/interleaved.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package output
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
type Interleaved struct{}
|
||||
|
||||
func (Interleaved) WrapWriter(stdOut, stdErr io.Writer, _ string, _ Templater) (io.Writer, io.Writer, CloseFunc) {
|
||||
return stdOut, stdErr, func() error { return nil }
|
||||
}
|
||||
51
internal/output/output.go
Normal file
51
internal/output/output.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package output
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
)
|
||||
|
||||
// Templater executes a template engine.
|
||||
// It is provided by the templater.Templater package.
|
||||
type Templater interface {
|
||||
// Replace replaces the provided template string with a rendered string.
|
||||
Replace(tmpl string) string
|
||||
}
|
||||
|
||||
type Output interface {
|
||||
WrapWriter(stdOut, stdErr io.Writer, prefix string, tmpl Templater) (io.Writer, io.Writer, CloseFunc)
|
||||
}
|
||||
|
||||
type CloseFunc func() error
|
||||
|
||||
// Build the Output for the requested taskfile.Output.
|
||||
func BuildFor(o *taskfile.Output) (Output, error) {
|
||||
switch o.Name {
|
||||
case "interleaved", "":
|
||||
if err := checkOutputGroupUnset(o); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return Interleaved{}, nil
|
||||
case "group":
|
||||
return Group{
|
||||
Begin: o.Group.Begin,
|
||||
End: o.Group.End,
|
||||
}, nil
|
||||
case "prefixed":
|
||||
if err := checkOutputGroupUnset(o); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return Prefixed{}, nil
|
||||
default:
|
||||
return nil, fmt.Errorf(`task: output style %q not recognized`, o.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func checkOutputGroupUnset(o *taskfile.Output) error {
|
||||
if o.Group.IsSet() {
|
||||
return fmt.Errorf("task: output style %q does not support the group begin/end parameter", o.Name)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
104
internal/output/output_test.go
Normal file
104
internal/output/output_test.go
Normal file
@@ -0,0 +1,104 @@
|
||||
package output_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"github.com/go-task/task/v3/internal/templater"
|
||||
"github.com/go-task/task/v3/taskfile"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/go-task/task/v3/internal/output"
|
||||
)
|
||||
|
||||
func TestInterleaved(t *testing.T) {
|
||||
var b bytes.Buffer
|
||||
var o output.Output = output.Interleaved{}
|
||||
var w, _, _ = o.WrapWriter(&b, io.Discard, "", nil)
|
||||
|
||||
fmt.Fprintln(w, "foo\nbar")
|
||||
assert.Equal(t, "foo\nbar\n", b.String())
|
||||
fmt.Fprintln(w, "baz")
|
||||
assert.Equal(t, "foo\nbar\nbaz\n", b.String())
|
||||
}
|
||||
|
||||
func TestGroup(t *testing.T) {
|
||||
var b bytes.Buffer
|
||||
var o output.Output = output.Group{}
|
||||
var stdOut, stdErr, cleanup = o.WrapWriter(&b, io.Discard, "", nil)
|
||||
|
||||
fmt.Fprintln(stdOut, "out\nout")
|
||||
assert.Equal(t, "", b.String())
|
||||
fmt.Fprintln(stdErr, "err\nerr")
|
||||
assert.Equal(t, "", b.String())
|
||||
fmt.Fprintln(stdOut, "out")
|
||||
assert.Equal(t, "", b.String())
|
||||
fmt.Fprintln(stdErr, "err")
|
||||
assert.Equal(t, "", b.String())
|
||||
|
||||
assert.NoError(t, cleanup())
|
||||
assert.Equal(t, "out\nout\nerr\nerr\nout\nerr\n", b.String())
|
||||
}
|
||||
|
||||
func TestGroupWithBeginEnd(t *testing.T) {
|
||||
tmpl := templater.Templater{
|
||||
Vars: &taskfile.Vars{
|
||||
Keys: []string{"VAR1"},
|
||||
Mapping: map[string]taskfile.Var{
|
||||
"VAR1": {Static: "example-value"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var o output.Output = output.Group{
|
||||
Begin: "::group::{{ .VAR1 }}",
|
||||
End: "::endgroup::",
|
||||
}
|
||||
t.Run("simple", func(t *testing.T) {
|
||||
var b bytes.Buffer
|
||||
var w, _, cleanup = o.WrapWriter(&b, io.Discard, "", &tmpl)
|
||||
|
||||
fmt.Fprintln(w, "foo\nbar")
|
||||
assert.Equal(t, "", b.String())
|
||||
fmt.Fprintln(w, "baz")
|
||||
assert.Equal(t, "", b.String())
|
||||
assert.NoError(t, cleanup())
|
||||
assert.Equal(t, "::group::example-value\nfoo\nbar\nbaz\n::endgroup::\n", b.String())
|
||||
})
|
||||
t.Run("no output", func(t *testing.T) {
|
||||
var b bytes.Buffer
|
||||
var _, _, cleanup = o.WrapWriter(&b, io.Discard, "", &tmpl)
|
||||
assert.NoError(t, cleanup())
|
||||
assert.Equal(t, "", b.String())
|
||||
})
|
||||
}
|
||||
|
||||
func TestPrefixed(t *testing.T) {
|
||||
var b bytes.Buffer
|
||||
var o output.Output = output.Prefixed{}
|
||||
var w, _, cleanup = o.WrapWriter(&b, io.Discard, "prefix", nil)
|
||||
|
||||
t.Run("simple use cases", func(t *testing.T) {
|
||||
b.Reset()
|
||||
|
||||
fmt.Fprintln(w, "foo\nbar")
|
||||
assert.Equal(t, "[prefix] foo\n[prefix] bar\n", b.String())
|
||||
fmt.Fprintln(w, "baz")
|
||||
assert.Equal(t, "[prefix] foo\n[prefix] bar\n[prefix] baz\n", b.String())
|
||||
assert.NoError(t, cleanup())
|
||||
})
|
||||
|
||||
t.Run("multiple writes for a single line", func(t *testing.T) {
|
||||
b.Reset()
|
||||
|
||||
for _, char := range []string{"T", "e", "s", "t", "!"} {
|
||||
fmt.Fprint(w, char)
|
||||
assert.Equal(t, "", b.String())
|
||||
}
|
||||
|
||||
assert.NoError(t, cleanup())
|
||||
assert.Equal(t, "[prefix] Test!\n", b.String())
|
||||
})
|
||||
}
|
||||
66
internal/output/prefixed.go
Normal file
66
internal/output/prefixed.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package output
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Prefixed struct{}
|
||||
|
||||
func (Prefixed) WrapWriter(stdOut, _ io.Writer, prefix string, _ Templater) (io.Writer, io.Writer, CloseFunc) {
|
||||
pw := &prefixWriter{writer: stdOut, prefix: prefix}
|
||||
return pw, pw, func() error { return pw.close() }
|
||||
}
|
||||
|
||||
type prefixWriter struct {
|
||||
writer io.Writer
|
||||
prefix string
|
||||
buff bytes.Buffer
|
||||
}
|
||||
|
||||
func (pw *prefixWriter) Write(p []byte) (int, error) {
|
||||
n, err := pw.buff.Write(p)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
return n, pw.writeOutputLines(false)
|
||||
}
|
||||
|
||||
func (pw *prefixWriter) close() error {
|
||||
return pw.writeOutputLines(true)
|
||||
}
|
||||
|
||||
func (pw *prefixWriter) writeOutputLines(force bool) error {
|
||||
for {
|
||||
switch line, err := pw.buff.ReadString('\n'); err {
|
||||
case nil:
|
||||
if err = pw.writeLine(line); err != nil {
|
||||
return err
|
||||
}
|
||||
case io.EOF:
|
||||
// if this line was not a complete line, re-add to the buffer
|
||||
if !force && !strings.HasSuffix(line, "\n") {
|
||||
_, err = pw.buff.WriteString(line)
|
||||
return err
|
||||
}
|
||||
|
||||
return pw.writeLine(line)
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (pw *prefixWriter) writeLine(line string) error {
|
||||
if line == "" {
|
||||
return nil
|
||||
}
|
||||
if !strings.HasSuffix(line, "\n") {
|
||||
line += "\n"
|
||||
}
|
||||
_, err := fmt.Fprintf(pw.writer, "[%s] %s", pw.prefix, line)
|
||||
return err
|
||||
}
|
||||
176
internal/sleepit/main.go
Normal file
176
internal/sleepit/main.go
Normal file
@@ -0,0 +1,176 @@
|
||||
// This code is released under the MIT License
|
||||
// Copyright (c) 2020 Marco Molteni and the timeit contributors.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
)
|
||||
|
||||
const usage = `sleepit: sleep for the specified duration, optionally handling signals
|
||||
When the line "sleepit: ready" is printed, it means that it is safe to send signals to it
|
||||
|
||||
Usage: sleepit <command> [<args>]
|
||||
|
||||
Commands
|
||||
|
||||
default Use default action: on reception of SIGINT terminate abruptly
|
||||
handle Handle signals: on reception of SIGINT perform cleanup before exiting
|
||||
version Show the sleepit version`
|
||||
|
||||
var (
|
||||
// Filled by the linker.
|
||||
fullVersion = "unknown" // example: v0.0.9-8-g941583d027-dirty
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Exit(run(os.Args[1:]))
|
||||
}
|
||||
|
||||
func run(args []string) int {
|
||||
if len(args) < 1 {
|
||||
fmt.Fprintln(os.Stderr, usage)
|
||||
return 2
|
||||
}
|
||||
|
||||
defaultCmd := flag.NewFlagSet("default", flag.ExitOnError)
|
||||
defaultSleep := defaultCmd.Duration("sleep", 5*time.Second, "Sleep duration")
|
||||
|
||||
handleCmd := flag.NewFlagSet("handle", flag.ExitOnError)
|
||||
handleSleep := handleCmd.Duration("sleep", 5*time.Second, "Sleep duration")
|
||||
handleCleanup := handleCmd.Duration("cleanup", 5*time.Second, "Cleanup duration")
|
||||
handleTermAfter := handleCmd.Int("term-after", 0,
|
||||
"Terminate immediately after `N` signals.\n"+
|
||||
"Default is to terminate only when the cleanup phase has completed.")
|
||||
|
||||
versionCmd := flag.NewFlagSet("version", flag.ExitOnError)
|
||||
|
||||
switch args[0] {
|
||||
|
||||
case "default":
|
||||
_ = defaultCmd.Parse(args[1:])
|
||||
if len(defaultCmd.Args()) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "default: unexpected arguments: %v\n", defaultCmd.Args())
|
||||
return 2
|
||||
}
|
||||
return supervisor(*defaultSleep, 0, 0, nil)
|
||||
|
||||
case "handle":
|
||||
_ = handleCmd.Parse(args[1:])
|
||||
if *handleTermAfter == 1 {
|
||||
fmt.Fprintf(os.Stderr, "handle: term-after cannot be 1\n")
|
||||
return 2
|
||||
}
|
||||
if len(handleCmd.Args()) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "handle: unexpected arguments: %v\n", handleCmd.Args())
|
||||
return 2
|
||||
}
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
signal.Notify(sigCh, os.Interrupt) // Ctrl-C -> SIGINT
|
||||
return supervisor(*handleSleep, *handleCleanup, *handleTermAfter, sigCh)
|
||||
|
||||
case "version":
|
||||
_ = versionCmd.Parse(args[1:])
|
||||
if len(versionCmd.Args()) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "version: unexpected arguments: %v\n", versionCmd.Args())
|
||||
return 2
|
||||
}
|
||||
fmt.Printf("sleepit version %s\n", fullVersion)
|
||||
return 0
|
||||
|
||||
default:
|
||||
fmt.Fprintln(os.Stderr, usage)
|
||||
return 2
|
||||
}
|
||||
}
|
||||
|
||||
func supervisor(
|
||||
sleep time.Duration,
|
||||
cleanup time.Duration,
|
||||
termAfter int,
|
||||
sigCh <-chan os.Signal,
|
||||
) int {
|
||||
fmt.Printf("sleepit: ready\n")
|
||||
fmt.Printf("sleepit: PID=%d sleep=%v cleanup=%v\n",
|
||||
os.Getpid(), sleep, cleanup)
|
||||
|
||||
cancelWork := make(chan struct{})
|
||||
workerDone := worker(cancelWork, sleep, "work")
|
||||
|
||||
cancelCleaner := make(chan struct{})
|
||||
var cleanerDone <-chan struct{}
|
||||
|
||||
sigCount := 0
|
||||
for {
|
||||
select {
|
||||
case sig := <-sigCh:
|
||||
sigCount++
|
||||
fmt.Printf("sleepit: got signal=%s count=%d\n", sig, sigCount)
|
||||
if sigCount == 1 {
|
||||
// since `cancelWork` is unbuffered, sending will be synchronous:
|
||||
// we are ensured that the worker has terminated before starting cleanup.
|
||||
// This is important in some real-life situations.
|
||||
cancelWork <- struct{}{}
|
||||
cleanerDone = worker(cancelCleaner, cleanup, "cleanup")
|
||||
}
|
||||
if sigCount == termAfter {
|
||||
cancelCleaner <- struct{}{}
|
||||
return 4
|
||||
}
|
||||
case <-workerDone:
|
||||
return 0
|
||||
case <-cleanerDone:
|
||||
return 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start a worker goroutine and return immediately a `workerDone` channel.
|
||||
// The goroutine will prepend its prints with the prefix `name`.
|
||||
// The goroutine will simulate some work and will terminate when one of the following
|
||||
// conditions happens:
|
||||
// 1. When `howlong` is elapsed. This case will be signaled on the `workerDone` channel.
|
||||
// 2. When something happens on channel `canceled`. Note that this simulates real-life,
|
||||
// so cancellation is not instantaneous: if the caller wants a synchronous cancel,
|
||||
// it should send a message; if instead it wants an asynchronous cancel, it should
|
||||
// close the channel.
|
||||
func worker(
|
||||
canceled <-chan struct{},
|
||||
howlong time.Duration,
|
||||
name string,
|
||||
) <-chan struct{} {
|
||||
workerDone := make(chan struct{})
|
||||
deadline := time.Now().Add(howlong)
|
||||
go func() {
|
||||
fmt.Printf("sleepit: %s started\n", name)
|
||||
for {
|
||||
select {
|
||||
case <-canceled:
|
||||
fmt.Printf("sleepit: %s canceled\n", name)
|
||||
return
|
||||
default:
|
||||
if doSomeWork(deadline) {
|
||||
fmt.Printf("sleepit: %s done\n", name) // <== NOTE THIS LINE
|
||||
workerDone <- struct{}{}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return workerDone
|
||||
}
|
||||
|
||||
// Do some work and then return, so that the caller can decide wether to continue or not.
|
||||
// Return true when all work is done.
|
||||
func doSomeWork(deadline time.Time) bool {
|
||||
if time.Now().After(deadline) {
|
||||
return true
|
||||
}
|
||||
timeout := 100 * time.Millisecond
|
||||
time.Sleep(timeout)
|
||||
return false
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user