diff --git a/.gitignore b/.gitignore index 808fcd2..dc38f2f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ kube-prompt # Output of the go coverage tool, specifically when used with LiteIDE *.out +pkg/ # glide vendor/ diff --git a/Makefile b/Makefile index c27110c..2f62e82 100644 --- a/Makefile +++ b/Makefile @@ -6,27 +6,40 @@ LDFLAGS := -X 'main.version=$(VERSION)' \ .DEFAULT_GOAL := help +.PHONY: setup setup: ## Setup for required tools. go get github.com/golang/lint/golint go get golang.org/x/tools/cmd/goimports go get -u github.com/golang/dep/cmd/dep +.PHONY: fmt fmt: ## Formatting source codes. @goimports -w ./kube +.PHONY: lint lint: ## Run golint and go vet. @golint ./kube/... @go vet ./kube/... +.PHONY: test test: ## Run the tests. @go test ./kube/... +.PHONY: build build: main.go ## Build a binary. go build -ldflags "$(LDFLAGS)" +.PHONY: cross +cross: main.go ## Build binaries for cross platform. + mkdir -p pkg + @for os in "darwin" "linux"; do \ + for arc in "amd64" "386"; do \ + GOOS=$${os} GOARC=$${arc} make build; \ + zip pkg/kube-prompt_$(VERSION)_$${os}_$${arc}.zip kube-prompt; \ + done; \ + done + +.PHONY: help help: ## Show help text @echo "Commands:" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' - -.PHONY: setup fmt lint test help build - diff --git a/README.md b/README.md index d611556..62471b6 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,49 @@ # kube-prompt -An interactive kubernetes client featuring auto-complete written in Go. +An interactive kubernetes client featuring auto-complete using [go-prompt](https://github.com/c-bata/go-prompt). ![demo](./_resources/kube-prompt.gif) kube-prompt's command is same with kubectl (because basically this is just wrapper). So it doesn't require the additional cost to learn the usage of kube-prompt. -Binaries are available from github releases: +## Installation -* macOS (darwin) -* Linux +#### Binary installation + +Binaries are available from [github release](https://github.com/c-bata/kube-prompt/releases). + +``` +# macOS (darwin) +curl -L https://github.com/c-bata/kube-prompt/releases/download/v1.0.0/kube-prompt_v0.1.0_darwin_amd64.zip +unzip kube-prompt_v1.0.0_darwin_amd64.zip + +# Linux +curl -L https://github.com/c-bata/kube-prompt/releases/download/v1.0.0/kube-prompt_v0.1.0_linux_amd64.zip +unzip kube-prompt_v1.0.0_linux_amd64.zip + +# After that please put executable to your PATH: +chmod +x kube-prompt +sudo mv ./kube-prompt /usr/local/bin/kube-prompt +``` + +#### Build from source + +```console +$ go get -u github.com/golang/dep/cmd/dep +$ dep ensure # download dependency package +$ go build . +``` + +To create a multi-platform binary, use the cross command via make: + +```console +$ make cross +``` ## Goal -Hopefully support following commands and resource types enough to operate kubernetes as kubectl. +Hopefully support following commands enough to operate kubernetes. * [x] `get` Display one or many resources * [x] `describe` Show details of a specific resource or group of resources