-
Notifications
You must be signed in to change notification settings - Fork 0
/
go
executable file
·41 lines (33 loc) · 670 Bytes
/
go
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
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd "${SCRIPT_DIR}"
function error {
echo -e >&2 "\033[31m${1}\033[0m";
exit 1;
}
function notice {
echo -e >&2 "\033[33m${1}\033[0m";
}
function ensure_env {
command -v git >/dev/null 2>&1 || error "Please install git"
}
function cmd_check {
cargo fix
cargo +nightly fmt
cargo clippy
RUSTDOCFLAGS="-D warnings" cargo doc
}
function cmd_usage {
echo "Currently only ./go check is supported";
}
ensure_env
command=""
if (( $# > 0 )); then
command="${1}"
shift
fi
case "${command}" in
check) cmd_check "$@" ;;
*) cmd_usage
esac