Skip to content

Commit

Permalink
🐞 fix: Display version
Browse files Browse the repository at this point in the history
Fix #8
  • Loading branch information
remileblond67076 committed Jan 10, 2025
1 parent 5a7815c commit 6a33375
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
mkdir -p build/windows-amd64
mkdir -p build/mac-amd64
mkdir -p build/mac-arm64
GOOS=linux GOARCH=amd64 go build -o build/linux-amd64/gristctl .
GOOS=darwin GOARCH=amd64 go build -o build/mac-amd64/gristctl .
GOOS=darwin GOARCH=arm64 go build -o build/mac-arm64/gristctl .
GOOS=windows GOARCH=amd64 go build -o build/windows-amd64/gristctl.exe .
GOOS=linux GOARCH=amd64 go build -o build/linux-amd64/gristctl -ldflags="-X main.version=${GITHUB_REF#refs/tags/}".
GOOS=darwin GOARCH=amd64 go build -o build/mac-amd64/gristctl -ldflags="-X main.version=${GITHUB_REF#refs/tags/}".
GOOS=darwin GOARCH=arm64 go build -o build/mac-arm64/gristctl -ldflags="-X main.version=${GITHUB_REF#refs/tags/}".
GOOS=windows GOARCH=amd64 go build -o build/windows-amd64/gristctl.exe -ldflags="-X main.version=${GITHUB_REF#refs/tags/}".
zip -r exec_files.zip build/*
tar -cv build/* | gzip > exec_files.tar.gz
- name: Archive exec file
Expand Down
8 changes: 7 additions & 1 deletion gristtools/gristtools.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ func Help() {
- purge doc <id> [<number of states to keep>]: purges document history (retains last 3 operations by default)
- delete doc <id> : delete a document
- delete user <id> : delete a user
- delete workspace <id> : delete a workspace`)
- delete workspace <id> : delete a workspace
- version : displays the version of the program`)
os.Exit(0)
}

// Displays the version of the program
func Version(version string) {
fmt.Println("Version : ", version)
}

/*
Configure Grist envfile (url and api token)
Interactive filling the `.gristctl` file
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"gristctl/gristtools"
)

var version = "Undefined"

func main() {
args := os.Args[1:]
if len(args) < 1 {
Expand All @@ -23,6 +25,8 @@ func main() {
switch arg1 := args[0]; arg1 {
case "config":
gristtools.Config()
case "version":
gristtools.Version(version)
case "get":
{
if len(args) > 1 {
Expand Down

0 comments on commit 6a33375

Please sign in to comment.