-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
75 lines (67 loc) · 2.25 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
# https://taskfile.dev
version: '3'
vars:
DIR_TASKFILES: Taskfile.d
FILE_TASK_START: "task-start-{{.TASK}}.tmp"
MAT_GIT_REPO: "https://gitlab.com/jfxs-multipass/multipass-ansible-toolkit/-/raw/main"
includes:
00:
taskfile: "./Taskfile.project.yml"
git:
taskfile: "./Taskfile.d/git.yml"
lint:
taskfile: "./Taskfile.d/lint.yml"
yarn:
taskfile: "./Taskfile.d/yarn.yml"
tasks:
usage:
desc: "[CORE] Show the usage of a task. Arguments: TSK|T=task-name [FILE|F=Taskfile.dist.yml] (*)"
summary: |
[CORE] Show the usage of a task.
Usage: task [-t Taskfile.dist.yml] usage TSK|T=<task-name> [FILE|F=Taskfile.dist.yml]
Arguments:
TSK | T Name of the task (required)
FILE | F Taskfile path (optional, by default Taskfile.yml)
vars:
TSK: '{{default .T .TSK}}'
FILE: '{{default .F .FILE}}'
D_FILE: '{{default "Taskfile.yml" .FILE}}'
cmds:
- |
if [ ! -f "{{.D_FILE}}" ]; then
echo "{{.D_FILE}} does not exist!"
exit 1
fi
- task -t "{{.D_FILE}}" --summary "{{.TSK}}" | sed '/^dependencies:$/,$d' | sed '/^commands:$/,$d'
preconditions:
- sh: test -n "{{.TSK}}" || test -n "{{.T}}"
msg: "TSK|T argument is required"
silent: true
default:
desc: "[CORE] List of available tasks. Arguments: [FILE|F=Taskfile.project.yml] (*)"
summary: |
[CORE] Show the list of available tasks.
Usage: task [FILE|F=Taskfile.project.yml]
Arguments:
FILE | F Taskfile project path (optional, by default Taskfile.project.yml)
vars:
FILE: '{{default .F .FILE}}'
D_FILE: '{{default "Taskfile.project.yml" .FILE}}'
cmds:
- |
if [ -d "{{.DIR_TASKFILES}}" ]; then
for template in {{.DIR_TASKFILES}}/*.yml
do
template_name=$(basename "$template")
printf "\033[0;33m[ %s: ]\033[0m " "${template_name%.yml}" && task --list -t "$template" || true
echo ""
done
fi
- |
if [ ! -z "{{.D_FILE}}" ]; then
printf "\033[0;33m[ %s: ]\033[0m " "00" && task --list -t "{{.D_FILE}}" || true
fi
echo ""
- echo " (*) <task usage TSK=task-name> will show the usage of the task."
silent: true