diff --git a/.gitignore b/.gitignore index 9591c6e..81e9868 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +out .DS_Store playground/ .vscode/ diff --git a/main.go b/main.go index f0582b8..0d8b1bd 100644 --- a/main.go +++ b/main.go @@ -15,6 +15,7 @@ import ( ) var log = logrus.New() +var version string = "0.0.0" func main() { commandName := flag.String("command", os.Getenv("SHELL"), "The command to run") @@ -25,8 +26,14 @@ func main() { logFileName := flag.String("logfile", "-", "The name of the file to log") useTLS := flag.Bool("useTLS", true, "Use TLS to connect to the server") server := flag.String("server", "go.tty-share.com:7654", "tty-server address") + versionFlag := flag.Bool("version", false, "Print the tty-share version") flag.Parse() + if *versionFlag { + fmt.Printf("%s\n", version) + return + } + log.Level = logrus.ErrorLevel if *logFileName != "-" { fmt.Printf("Writing logs to: %s\n", *logFileName) diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..2be4664 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,11 @@ +set -ev +VERSION=$(git describe --tags `git rev-list --tags --max-count=1` | awk '{print substr($1,2); }') +OUTDIR=out + +mkdir -p ${OUTDIR} && \ + GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-X main.version=${VERSION}" -o ${OUTDIR}/tty-share.rpi && \ + GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o ${OUTDIR}/tty-share.lin && \ + GOOS=darwin go build -ldflags "-X main.version=${VERSION}" -o ${OUTDIR}/tty-share.mac && \ + zip ${OUTDIR}/tty-share.rpi.zip ${OUTDIR}/tty-share.rpi && \ + zip ${OUTDIR}/tty-share.lin.zip ${OUTDIR}/tty-share.lin && \ + zip ${OUTDIR}/tty-share.mac.zip ${OUTDIR}/tty-share.mac