refactor main

This commit is contained in:
Christoph Polcin 2018-05-16 12:23:42 +02:00
parent 8a7d0f4982
commit 056ad2c4d5
3 changed files with 14 additions and 15 deletions

6
.gitignore vendored
View File

@ -1,2 +1,4 @@
src /src
bin /bin
/pkg
/gowebdav

View File

@ -1,20 +1,17 @@
SRC := $(wildcard *.go) main/client.go BIN := gowebdav
BIN := bin SRC := $(wildcard *.go) cmd/gowebdav/main.go
CLIENT := ${BIN}/client
all: test client all: test cmd
client: ${CLIENT} cmd: ${BIN}
${CLIENT}: ${SRC} ${BIN}: ${SRC}
@echo build $@ go build -o $@ ./cmd/gowebdav
go build -o $@ -- main/client.go
test: test:
go test go test ./...
clean: clean:
@echo clean ${BIN} @rm -f ${BIN}
@rm -f ${BIN}/*
.PHONY: all client clean .PHONY: all cmd clean test

View File

@ -14,7 +14,7 @@ func fail(err interface{}) {
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
} else { } else {
fmt.Println("Usage: client FLAGS ARGS") fmt.Println("Usage: gowebdav FLAGS ARGS")
fmt.Println("Flags:") fmt.Println("Flags:")
flag.PrintDefaults() flag.PrintDefaults()
fmt.Println("Method <ARGS>") fmt.Println("Method <ARGS>")