Skip to content

Commit

Permalink
Consolidate
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Aug 6, 2022
1 parent 9abe001 commit e8ca43d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 88 deletions.
75 changes: 0 additions & 75 deletions .plsdo.sh

This file was deleted.

50 changes: 37 additions & 13 deletions do
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail

source .plsdo.sh
declare -A help

binary() {
mkdir -p dist
Expand All @@ -13,18 +14,7 @@ binary-static() {
}

update-golden() {
#_update-golden
if ldd ./dist/gotestsum > /dev/null 2>&1; then
binary-static
fi
GOLANG_VERSION=1.13-alpine ./do shell ./do _update-golden
GOLANG_VERSION=1.14.6-alpine ./do shell ./do _update-golden
}

_update-golden() {
PATH="$PWD/dist:$PATH" gotestsum -- \
./cmd ./testjson ./internal/junitxml ./cmd/tool/slowest \
-test.update-golden
gotestsum -- ./... -update
}

lint() {
Expand Down Expand Up @@ -83,4 +73,38 @@ godoc() {
command godoc -http=:6060
}

help[list]="Print the list of tasks"
list() {
declare -F | awk '{print $3}' | grep -v '^_'
}

_plsdo_help() {
local topic="${1-}"
# print help for the topic
if [ -n "$topic" ]; then
if ! command -v "$topic" > /dev/null ; then
>&2 echo "No such task: $topic"
return 1
fi

printf "\nUsage:\n %s %s\n\n%s\n" "$0" "$topic" "${help[$topic]-}"
return 0
fi

# print list of tasks and their help line.
[ -n "${banner-}" ] && echo "$banner" && echo
for i in $(list); do
printf "%-12s\t%s\n" "$i" "${help[$i]-}" | head -1
done
}

_plsdo_run() {
case "${1-}" in
""|help)
_plsdo_help "${2-}" ;;
*)
"$@" ;;
esac
}

_plsdo_run "$@"

0 comments on commit e8ca43d

Please sign in to comment.