Skip to content

Commit

Permalink
Merge pull request #9 from let-us-go/develop
Browse files Browse the repository at this point in the history
New Release: v0.2.0
  • Loading branch information
mozillazg authored May 30, 2018
2 parents f181af8 + d4882a5 commit 4539926
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ language: go
go:
- 1.8
- 1.9
- '1.10'

sudo: false

install:
- go get .
- go build
- ./zkcli -version
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog


## [0.2.0] (2018-05-30)

### New Features

* Add `-version` to show version info ([add69127e](https://github.com/let-us-go/zkcli/commit/add69127e15a855f934629ef437286d416122fc8))

```
$ zkcli -version
Version: 0.2.0
Git commit: 9fd746b
Built: 2018-05-30T13:44:21+0000
```

### Internal changes

* Remove unnecessary qiniupkg ([1c33d63f590](https://github.com/let-us-go/zkcli/commit/1c33d63f590598c166ef0fcb4eb6554ca8bdee1c))
* Close connection before exit ([4c5d6a4d](https://github.com/let-us-go/zkcli/commit/4c5d6a4dc16d28deec01df6c873e69b27b985f61))
* Ignored with the suffix slash of zpath when completion ([#7](https://github.com/let-us-go/zkcli/pull/7))


## 0.1.0 (2017-12-23)

* Initial Release


[0.2.0]: https://github.com/let-us-go/zkcli/compare/v0.1.0...v0.2.0
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
.PHONY: help
help:
@echo "lint run lint"
@echo "release-all compile for all platforms "
@echo "release-all compile for all platforms "

PROJECT=zkcli
VERSION=$(shell cat main.go |grep 'version = "[0-9]\+.[0-9]\+.[0-9]\+"' | awk -F '"' '{print $$2}')
GIT_COMMIT=$(shell git rev-parse --short HEAD)
BUILT_TIME=$(shell date -u '+%FT%T%z')

GOVERSION=$(shell go version)
GOOS=$(word 1,$(subst /, ,$(lastword $(GOVERSION))))
GOARCH=$(word 2,$(subst /, ,$(lastword $(GOVERSION))))
LDFLAGS="-X main.gitCommit=${GIT_COMMIT} -X main.built=${BUILT_TIME}"

ARCNAME=$(PROJECT)-$(VERSION)-$(GOOS)-$(GOARCH)
RELDIR=$(ARCNAME)
Expand All @@ -20,7 +23,7 @@ release:
rm -rf $(DISTDIR)/$(RELDIR)
mkdir -p $(DISTDIR)/$(RELDIR)
go clean
GOOS=$(GOOS) GOARCH=$(GOARCH) go build
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -ldflags ${LDFLAGS}
cp $(PROJECT)$(SUFFIX_EXE) $(DISTDIR)/$(RELDIR)/
tar czf $(DISTDIR)/$(ARCNAME).tar.gz -C $(DISTDIR) $(RELDIR)
go clean
Expand All @@ -35,4 +38,5 @@ release-all:
lint:
gofmt -s -w .
golint .
golint core
go vet
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ go install github.com/let-us-go/zkcli
### Build

```
make release
make release-all
```

Or [download a pre-built binary](https://github.com/let-us-go/zkcli/releases) for Linux or macOS/OSX.
Expand Down
2 changes: 1 addition & 1 deletion core/completer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func argumentsCompleter(args []string, cmd *Cmd) []prompt.Suggest {
first := args[0]
switch first {
case "get", "ls", "create", "set", "delete":
p := args[1]
p := strings.TrimSuffix(args[1], "/")
if len(args) > 2 {
switch first {
case "create", "set":
Expand Down
2 changes: 1 addition & 1 deletion core/config.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package core

import (
"errors"
"fmt"
"strings"
"time"

"github.com/samuel/go-zookeeper/zk"
"qiniupkg.com/x/errors.v7"
)

type Config struct {
Expand Down
13 changes: 12 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,25 @@ import (
"github.com/let-us-go/zkcli/core"
)

const version = "0.1.0"
var gitCommit = "unknown"
var built = "unknown"

const version = "0.2.0"

func main() {
servers := flag.String("s", "127.0.0.1:2181", "Servers")
username := flag.String("u", "", "Username")
password := flag.String("p", "", "Password")
showVersion := flag.Bool("version", false, "Show version info")
flag.Parse()
args := flag.Args()

if *showVersion {
fmt.Printf("Version:\t%s\nGit commit:\t%s\nBuilt: %s\n",
version, gitCommit, built)
os.Exit(0)
}

config := core.NewConfig(strings.Split(*servers, ","))
if *username != "" && *password != "" {
auth := core.NewAuth(
Expand All @@ -31,6 +41,7 @@ func main() {
fmt.Printf("%s\n", err)
os.Exit(1)
}
defer conn.Close()

name, options := core.ParseCmd(strings.Join(args, " "))
cmd := core.NewCmd(name, options, conn, config)
Expand Down

0 comments on commit 4539926

Please sign in to comment.