cli has dry mode and install script

This commit is contained in:
Bel LaPointe
2021-12-31 22:27:33 -05:00
parent f7dac79233
commit 24154df995
2 changed files with 34 additions and 7 deletions

16
cmd/pttodo-cli/install.sh Normal file
View File

@@ -0,0 +1,16 @@
#! /bin/bash
binary_name="$(head -n 1 go.mod | awk '{print $NF}' | sed 's/.*\///')"
git_commit="$((
git rev-list -1 HEAD
if git diff | grep . > /dev/null; then
echo "-dirty"
fi
) 2> /dev/null | tr -d '\n')"
CGO_ENABLED=0 \
go build \
-o $GOPATH/bin/$binary_name \
-a \
-installsuffix cgo \
-ldflags "-s -w -X main.GitCommit=$git_commit"