diff --git a/.gitignore b/.gitignore index ca83d7c..25f2ea8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ build nohup.out build_config.mk var* -*.log \ No newline at end of file +*.log +bin \ No newline at end of file diff --git a/Makefile b/Makefile index 55afc4e..3c240de 100644 --- a/Makefile +++ b/Makefile @@ -14,14 +14,11 @@ export GO_BUILD_TAGS all: build build: - $(GO) install -tags '$(GO_BUILD_TAGS)' ./... + $(GO) install -tags 'linenoise $(GO_BUILD_TAGS)' ./... build_use_lmdb: - $(GO) install -tags '$(GO_BUILD_TAGS) lmdb' ./... - -clean: - $(GO) clean -i ./... - + $(GO) install -tags 'linenoise $(GO_BUILD_TAGS) lmdb' ./... + test: $(GO) test --race -tags '$(GO_BUILD_TAGS)' ./... @@ -40,5 +37,8 @@ test_store: test_rpl: $(GO) test --race -tags '$(GO_BUILD_TAGS)' ./rpl +clean: + $(GO) clean -i ./... + fmt: go fmt ./... \ No newline at end of file diff --git a/cmd/ledis-cli/complietion.go b/cmd/ledis-cli/complietion.go new file mode 100644 index 0000000..381ac86 --- /dev/null +++ b/cmd/ledis-cli/complietion.go @@ -0,0 +1,16 @@ +package main + +// CompletionHandler provides possible completions for given input +type CompletionHandler func(input string) []string + +// DefaultCompletionHandler simply returns an empty slice. +var DefaultCompletionHandler = func(input string) []string { + return make([]string, 0) +} + +var complHandler = DefaultCompletionHandler + +// SetCompletionHandler sets the CompletionHandler to be used for completion +func SetCompletionHandler(c CompletionHandler) { + complHandler = c +} diff --git a/cmd/ledis-cli/const.go b/cmd/ledis-cli/const.go index 5404cf4..cc3f4d9 100644 --- a/cmd/ledis-cli/const.go +++ b/cmd/ledis-cli/const.go @@ -1,4 +1,4 @@ -//This file was generated by .tools/generate_commands.py on Thu Mar 05 2015 15:42:49 +0800 +//This file was generated by .tools/generate_commands.py on Thu Mar 05 2015 15:42:49 +0800 package main var helpCommands = [][]string{ diff --git a/cmd/ledis-cli/linenoise.c b/cmd/ledis-cli/linenoise.c index aef5cdd..e5784d4 100644 --- a/cmd/ledis-cli/linenoise.c +++ b/cmd/ledis-cli/linenoise.c @@ -1,3 +1,5 @@ +// +build linenoise + /* linenoise.c -- guerrilla line editing library against the idea that a * line editing lib needs to be 20,000 lines of C code. * diff --git a/cmd/ledis-cli/linenoise.go b/cmd/ledis-cli/linenoise.go index 4bb49af..b872b18 100644 --- a/cmd/ledis-cli/linenoise.go +++ b/cmd/ledis-cli/linenoise.go @@ -1,3 +1,5 @@ +// +build linenoise + package main //#include @@ -47,21 +49,6 @@ func setHistoryCapacity(capacity int) error { return nil } -// CompletionHandler provides possible completions for given input -type CompletionHandler func(input string) []string - -// DefaultCompletionHandler simply returns an empty slice. -var DefaultCompletionHandler = func(input string) []string { - return make([]string, 0) -} - -var complHandler = DefaultCompletionHandler - -// SetCompletionHandler sets the CompletionHandler to be used for completion -func SetCompletionHandler(c CompletionHandler) { - complHandler = c -} - // typedef struct linenoiseCompletions { // size_t len; // char **cvec; diff --git a/cmd/ledis-cli/linenoise.h b/cmd/ledis-cli/linenoise.h index e22ebd3..fca81f0 100644 --- a/cmd/ledis-cli/linenoise.h +++ b/cmd/ledis-cli/linenoise.h @@ -1,3 +1,5 @@ +// +build linenoise + /* linenoise.h -- guerrilla line editing library against the idea that a * line editing lib needs to be 20,000 lines of C code. * diff --git a/cmd/ledis-cli/linenoiseCompletionCallbackHook.c b/cmd/ledis-cli/linenoiseCompletionCallbackHook.c index 7561d22..08384fe 100644 --- a/cmd/ledis-cli/linenoiseCompletionCallbackHook.c +++ b/cmd/ledis-cli/linenoiseCompletionCallbackHook.c @@ -1,3 +1,4 @@ +// +build linenoise #include "linenoiseCompletionCallbackHook.h" diff --git a/cmd/ledis-cli/linenoiseCompletionCallbackHook.h b/cmd/ledis-cli/linenoiseCompletionCallbackHook.h index 071170c..fc59e2c 100644 --- a/cmd/ledis-cli/linenoiseCompletionCallbackHook.h +++ b/cmd/ledis-cli/linenoiseCompletionCallbackHook.h @@ -1,3 +1,4 @@ +// +build linenoise #include #include "linenoise.h" diff --git a/cmd/ledis-cli/main.go b/cmd/ledis-cli/main.go index 38097a6..164d8ba 100644 --- a/cmd/ledis-cli/main.go +++ b/cmd/ledis-cli/main.go @@ -1,3 +1,5 @@ +// +build linenoise + package main import ( diff --git a/cmd/ledis-cli/nolinenoise.go b/cmd/ledis-cli/nolinenoise.go new file mode 100644 index 0000000..55d7bc1 --- /dev/null +++ b/cmd/ledis-cli/nolinenoise.go @@ -0,0 +1,7 @@ +// +build !linenoise + +package main + +func main() { + println("Please use linenoise to build again, or use redis-cli instead") +}