-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·50 lines (37 loc) · 1.05 KB
/
run.sh
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
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
# -----------------------------------------------------------------------------
# Helper functions start with _ and aren't listed in this script's help menu.
# -----------------------------------------------------------------------------
function _pipenv_run {
pipenv run "${@}"
}
function _pipenv_script {
_pipenv_run python "${@}"
}
# -----------------------------------------------------------------------------
function cmd {
# Run any command you want in the web container
_pipenv_run "${@}"
}
function python {
_pipenv_script "${@}"
}
function lint {
# Lint Python code
cmd flake8 "${@}"
}
function format {
# Format Python code
cmd black . "${@}"
}
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
# This idea is heavily inspired by: https://github.com/adriancooney/Taskfile
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"