Skip to content

Commit cd919e6

Browse files
authored
fix(scripts): add GOBIN fallback and support any cwd (#430)
1 parent 6b79c5d commit cd919e6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

scripts/participle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
22
set -euo pipefail
3-
(cd "$(dirname "$0")/../cmd/participle" && go install github.com/alecthomas/participle/v2/cmd/participle)
4-
exec "$(go env GOBIN)/participle" "$@"
3+
GOBIN=$(go env GOBIN)
4+
[[ -d "${GOBIN}" ]] || GOBIN=$(go env GOPATH)/bin
5+
go install -C "$(dirname "$0")/../cmd/participle" 'github.com/alecthomas/participle/v2/cmd/participle'
6+
exec "${GOBIN}/participle" "$@"

scripts/regen-lexer

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/bin/bash
22
set -euo pipefail
3-
participle gen lexer --name GeneratedBasic internal < lexer/internal/basiclexer.json | gofmt > lexer/internal/basiclexer.go
3+
path=$(dirname "${0}")
4+
base="${path}/../lexer/internal/basiclexer"
5+
"${path}/participle" gen lexer --name GeneratedBasic internal < "${base}.json" | gofmt > "${base}.go"

0 commit comments

Comments
 (0)