Skip to content

Commit

Permalink
Added build file
Browse files Browse the repository at this point in the history
  • Loading branch information
j.neubauer committed Apr 14, 2020
1 parent 393fcd8 commit f69422a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

VERSION=0.1
DATE=`date -u '+%Y-%m-%d_%H:%M:%S'`

build() {
go build -o azure-sb-cli$EXT -ldflags "-X main.buildVersion=$VERSION -X main.buildDate=$DATE" main.go
}
build
GOOS=windows GOARCH=386 EXT=.exe build
13 changes: 12 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
"github.com/Azure/azure-service-bus-go"
)

var buildVersion = "unknown"
var buildDate="unknown"

const NullStr = "\xff"

var logDebug = false
Expand Down Expand Up @@ -151,8 +154,9 @@ func usage() {
fmt.Println(`Usage: ` + os.Args[0] + ` <command> <options>
Commands:
send - Sends messages to a queue. Reads standard input, sending each line as message, all in same session.
send - Sends messages to a queue. Reads standard input, sending each line as message, all in same session.
receive - Receives messages, outputting them to standard output, message per line.
-v - Prints version info.
Common options:
-c Connection string
Expand All @@ -169,6 +173,10 @@ Receive options:
`)
}

func printVersion() {
fmt.Println(os.Args[0] + " " + buildVersion + " (built " + buildDate + ")")
}

func main() {
commonFlags := flag.NewFlagSet("common flags", flag.ExitOnError)
connStrPtr := commonFlags.String("c", "", "Connection string")
Expand All @@ -186,6 +194,9 @@ func main() {
case "-h":
usage()
return
case "-v":
printVersion()
return
case "receive":
commonFlags.BoolVar(&prefixMsgWithSessionId, "p", false, "Prefix received messages with session id, separated with ':'")
}
Expand Down

0 comments on commit f69422a

Please sign in to comment.