Add --version command line flag

pull/14/merge v0.6.0
Vasile Popescu 4 years ago
parent ca450682c0
commit b395112857

1
.gitignore vendored

@ -1,3 +1,4 @@
out
.DS_Store
playground/
.vscode/

@ -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)

@ -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
Loading…
Cancel
Save