-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile
executable file
·73 lines (65 loc) · 1.94 KB
/
Taskfile
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
#!/bin/bash
function alias-me {
alias run="${PWD}/Taskfile"
}
function init-module {
if [ -z "${1}" ]
then
echo "Usage: ./Taskfile init-module MODULE_DIR"
exit 1
fi
if [ ! -d "${1}" ]
then
echo "Error: The given service directory '${1}' is not a valid directory"
echo "Usage: ./Taskfile init-module MODULE_DIR"
exit 1
fi
docker compose run --rm -v "${1}:/kb/module_dir" ds-widget-tool "python src/init_module.py /kb/module_dir"
}
function check-module {
if [ -z "${1}" ]
then
echo "Usage: ./Taskfile shell MODULE_DIR"
exit 1
fi
if [ ! -d "${1}" ]
then
echo "Error: The given service directory '${1}' is not a valid directory"
echo "Usage: ./Taskfile check-module MODULE_DIR"
exit 1
fi
echo "Using service directory ${1}"
docker compose run --rm -v "${1}:/kb/module_dir" ds-widget-tool "python src/check_module.py /kb/module_dir"
}
function shell {
if [ -z "${1}" ]
then
echo "Usage: ./Taskfile shell MODULE_DIR"
exit 1
fi
if [ ! -d "${1}" ]
then
echo "Error: The given service directory '${1}' is not a valid directory"
echo "Usage: ./Taskfile shell MODULE_DIR"
exit 1
fi
echo "Using service directory ${1}"
docker compose run --rm -v "${1}:/kb/module_dir" ds-widget-tool bash
}
function bash {
docker compose run --rm ds-widget-tool bash
}
function status {
docker compose run --rm ds-widget-tool "python src/status.py"
}
function help {
echo "$(basename $0) <task> <args>"
echo "Runs the tasks listed below."
echo "To find out more about them, either read the source"
echo "for $(basename ${0}) or the docs located in 'docs/tasks.md'."
echo "Tasks:"
# Note that this omits private functions - those prefixed with an _
compgen -A function | grep -e '^[^_]' | cat -n
}
TIMEFORMAT="Task completed in %3lR"
time "${@:-help}"