-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
87 lines (69 loc) · 1.55 KB
/
Justfile
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
76
77
78
79
80
81
82
83
84
85
86
PROJECT_NAME := "GzipDate"
alias arc := archive
@_default:
just _term-wipe
just --list
# Archive GoReleaser dist
archive:
#!/bin/sh
just _term-wipe
tag="$(git tag --points-at main)"
app="{{PROJECT_NAME}}"
arc="${app}_${tag}"
# echo "app = '${app}'"
# echo "tag = '${tag}'"
# echo "arc = '${arc}'"
if [ ! -e distro ]; then
mkdir distro
fi
if [ -e dist ]; then
echo "Move dist -> distro/${arc}"
mv dist "distro/${arc}"
# echo "cd distro"
cd distro
printf "pwd = "
pwd
ls -Alh
else
echo "dist directory not found for archiving"
fi
# Build and install app
build:
@just _term-wipe
go build -o gzipdate main.go
mv gzipdate "${GOBIN}/"
@# go install main.go
# Build distro
distro:
#!/bin/sh
goreleaser
just archive
# Run code
run +args='':
@just _term-wipe
go run main.go {{args}}
# Run a test
@test cmd="coverage":
just _term-wipe
just test-{{cmd}}
# Run Go Unit Tests
@test-coverage:
just _term-wipe
echo "You need to run:"
echo "go test -coverprofile=c.out"
echo "go tool cover -func=c.out"
_term-wipe:
#!/bin/sh
if [[ ${#VISUAL_STUDIO_CODE} -gt 0 ]]; then
clear
elif [[ ${KITTY_WINDOW_ID} -gt 0 ]] || [[ ${#TMUX} -gt 0 ]] || [[ "${TERM_PROGRAM}" = 'vscode' ]]; then
printf '\033c'
elif [[ "$(uname)" == 'Darwin' ]] || [[ "${TERM_PROGRAM}" = 'Apple_Terminal' ]] || [[ "${TERM_PROGRAM}" = 'iTerm.app' ]]; then
osascript -e 'tell application "System Events" to keystroke "k" using command down'
elif [[ -x "$(which tput)" ]]; then
tput reset
elif [[ -x "$(which reset)" ]]; then
reset
else
clear
fi