-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·58 lines (41 loc) · 1.44 KB
/
run.sh
File metadata and controls
executable file
·58 lines (41 loc) · 1.44 KB
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
#!/usr/bin/env bash
set -o errexit
set -o pipefail
GOFUMPT_CMD="sudo docker run --rm -it -e GOFUMPT_SPLIT_LONG_LINES=on -v $(pwd):/work ghcr.io/hellt/gofumpt:0.3.1"
GOFUMPT_FLAGS="-l -w ."
GODOT_CMD="sudo docker run --rm -it -v $(pwd):/work ghcr.io/hellt/godot:1.4.11"
GODOT_FLAGS="-w ."
GOLANGCI_CMD="sudo docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint"
GOLANGCI_FLAGS="run -v ./..."
function gofumpt {
${GOFUMPT_CMD} ${GOFUMPT_FLAGS}
}
function godot {
${GODOT_CMD} ${GODOT_FLAGS}
}
function format {
gofumpt
godot
}
function golangci-lint {
${GOLANGCI_CMD} ${GOLANGCI_FLAGS}
}
_run_sh_autocomplete() {
local current_word
COMPREPLY=()
current_word="${COMP_WORDS[COMP_CWORD]}"
# Get list of function names in run.sh
local functions=$(declare -F -p | cut -d " " -f 3 | grep -v "^_" | grep -v "nvm_")
# Generate autocompletions based on the current word
COMPREPLY=( $(compgen -W "${functions}" -- ${current_word}) )
}
# Specify _run_sh_autocomplete as the source of autocompletions for run.sh
complete -F _run_sh_autocomplete ./run.sh
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | grep -v "nvm_" | 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}"