Skip to content

Commit

Permalink
ability to show version
Browse files Browse the repository at this point in the history
  • Loading branch information
piranha committed Feb 21, 2015
1 parent 8d8dc56 commit 512a319
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
SOURCE = $(wildcard *.go)
TAG ?= $(shell git describe --tags)
GOBUILD = go build -ldflags '-w'

ALL = $(foreach suffix,win.exe linux osx,\
build/webhooker-$(suffix))

all: $(ALL)

clean:
rm -f $(ALL)

test:
go test
cram tests/cram.t

win.exe = windows
osx = darwin
build/webhooker-%: $(SOURCE)
@mkdir -p $(@D)
CGO_ENABLED=0 GOOS=$(firstword $($*) $*) GOARCH=amd64 go build -o $@

upload: $(ALL)
ifndef UPLOAD_PATH
@echo "Define UPLOAD_PATH to determine where files should be uploaded"
release: $(ALL)
ifndef desc
@echo "Run it as 'make release desc=tralala'"
else
rsync -l -P $(ALL) $(UPLOAD_PATH)
github-release release -u piranha -r webhooker -t "$(TAG)" -n "$(TAG)" --description "$(desc)"
@for x in $(ALL); do \
echo "Uploading $$x" && \
github-release upload -u piranha \
-r webhooker \
-t $(TAG) \
-f "$$x" \
-n "$$(basename $$x)"; \
done
endif

test:
go test
cram tests/cram.t
1 change: 1 addition & 0 deletions tests/cram.t
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Usage:
-l, --log= path to file for logging
-c, --config= read rules from this file
-d, --dump dump rules to console
-V, --version show version and exit
--help show this help message
Check that it works:
Expand Down
15 changes: 8 additions & 7 deletions webhooker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ import (

/// Globals

var Version = "0.1"
var Version = "0.2"

var opts struct {
Interface string `short:"i" long:"interface" default:"" description:"ip to listen on"`
Port string `short:"p" long:"port" default:"8000" description:"port to listen on"`
Log string `short:"l" long:"log" description:"path to file for logging"`
Config string `short:"c" long:"config" description:"read rules from this file"`
Dump bool `short:"d" long:"dump" description:"dump rules to console"`
ShowHelp bool `long:"help" description:"show this help message"`
Interface string `short:"i" long:"interface" default:"" description:"ip to listen on"`
Port string `short:"p" long:"port" default:"8000" description:"port to listen on"`
Log string `short:"l" long:"log" description:"path to file for logging"`
Config string `short:"c" long:"config" description:"read rules from this file"`
Dump bool `short:"d" long:"dump" description:"dump rules to console"`
Version bool `short:"V" long:"version" description:"show version and exit"`
ShowHelp bool ` long:"help" description:"show this help message"`
}

/// Core interfaces
Expand Down

0 comments on commit 512a319

Please sign in to comment.