Merge pull request #122 from swordbeta/version-number-flag

Add version flag which displays the current version.
This commit is contained in:
Ian Kent 2016-11-14 21:02:59 +00:00 committed by GitHub
commit 899774fe8f
2 changed files with 7 additions and 1 deletions

View file

@ -6,7 +6,7 @@ combined:
go install .
release: tag release-deps dockerhub
gox -output="build/{{.Dir}}_{{.OS}}_{{.Arch}}" .
gox -ldflags "-X main.version=${VERSION}" -output="build/{{.Dir}}_{{.OS}}_{{.Arch}}" .
fmt:
go fmt ./...

View file

@ -25,6 +25,7 @@ var apiconf *cfgapi.Config
var uiconf *cfgui.Config
var comconf *cfgcom.Config
var exitCh chan int
var version string
func configure() {
cfgcom.RegisterFlags()
@ -40,6 +41,11 @@ func configure() {
}
func main() {
if len(os.Args) > 1 && (os.Args[1] == "-version" || os.Args[1] == "--version") {
fmt.Println("MailHog version: " + version)
os.Exit(0)
}
if len(os.Args) > 1 && os.Args[1] == "sendmail" {
args := os.Args
os.Args = []string{args[0]}