This commit is contained in:
Nuno Cruces 2021-08-11 23:32:43 +01:00
parent 9014d45ce8
commit 2fa0d652db
2 changed files with 18 additions and 4 deletions

View file

@ -1,19 +1,21 @@
#!/bin/bash #!/bin/bash
TAG=$(git tag --sort=-version:refname | head -n 1)
go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo go run github.com/josephspurrier/goversioninfo/cmd/goversioninfo
GOOS=windows GOARCH=386 go build -ldflags="-s -w" -trimpath && GOOS=windows GOARCH=386 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath &&
zip -9 zenity_win32.zip zenity.exe && zip -9 zenity_win32.zip zenity.exe &&
rm zenity.exe rm zenity.exe
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -trimpath && GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath &&
zip -9 zenity_win64.zip zenity.exe && zip -9 zenity_win64.zip zenity.exe &&
rm zenity.exe rm zenity.exe
rm resource.syso rm resource.syso
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o zenity_macos_x64 && GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath -o zenity_macos_x64 &&
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o zenity_macos_arm && GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X main.tag=$TAG" -trimpath -o zenity_macos_arm &&
go run github.com/randall77/makefat zenity zenity_macos_x64 zenity_macos_arm && go run github.com/randall77/makefat zenity zenity_macos_x64 zenity_macos_arm &&
zip -9 zenity_macos.zip zenity && zip -9 zenity_macos.zip zenity &&
rm zenity zenity_macos_* rm zenity zenity_macos_*

View file

@ -7,6 +7,7 @@ import (
"context" "context"
"errors" "errors"
"flag" "flag"
"fmt"
"image/color" "image/color"
"os" "os"
"os/exec" "os/exec"
@ -23,6 +24,8 @@ const (
unspecified = "\x00" unspecified = "\x00"
) )
var tag = "v0.0.0"
var ( var (
// Application Options // Application Options
errorDlg bool errorDlg bool
@ -88,6 +91,9 @@ var (
unixeol bool unixeol bool
cygpath bool cygpath bool
wslpath bool wslpath bool
// Command options
version bool
) )
func init() { func init() {
@ -233,6 +239,7 @@ func setupFlags() {
} }
// Command options // Command options
flag.BoolVar(&version, "version", false, "Show version of program")
flag.IntVar(&zenutil.Timeout, "timeout", 0, "Set dialog `timeout` in seconds") flag.IntVar(&zenutil.Timeout, "timeout", 0, "Set dialog `timeout` in seconds")
flag.StringVar(&zenutil.Separator, "separator", "|", "Set output `separator` character") flag.StringVar(&zenutil.Separator, "separator", "|", "Set output `separator` character")
@ -247,6 +254,11 @@ func setupFlags() {
func validateFlags() { func validateFlags() {
var n int var n int
if version {
fmt.Printf("zenity %s %s/%s\n", tag, runtime.GOOS, runtime.GOARCH)
fmt.Println("https://github.com/ncruces/zenity")
os.Exit(0)
}
if errorDlg { if errorDlg {
n++ n++
} }