summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen <stephengroat@users.noreply.github.com>2018-03-22 15:17:52 -0700
committerGitHub <noreply@github.com>2018-03-22 15:17:52 -0700
commitce734ec2d33c6ebd18ee730e621798442db762f7 (patch)
tree8e1707510eff5f4fe7a6960835788a74164b567a
parent3c784ce8b4c721a47ea65b72a6f18dbdd1762954 (diff)
parent6090a7f1b03b59924e15610d7023106bc2bcf729 (diff)
Merge branch 'master' into patch-1
-rw-r--r--Makefile53
-rw-r--r--README.md20
-rw-r--r--cmd/jp/bar.go12
-rw-r--r--cmd/jp/line.go16
-rw-r--r--docs/bar_chart.pngbin0 -> 46350 bytes
-rw-r--r--docs/line_chart.pngbin0 -> 41045 bytes
6 files changed, 73 insertions, 28 deletions
diff --git a/Makefile b/Makefile
index 48011e3..a12c493 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = 1.0.0
+VERSION = 1.0.1
APP := jp
PACKAGES := $(shell go list -f {{.Dir}} ./...)
@@ -8,26 +8,27 @@ GOFILES := $(wildcard $(GOFILES))
.PHONY: clean release docker docker-latest
# go get -u github.com/github/hub
+
+docker-latest: docker
+ docker tag quay.io/sergey_grebenshchikov/$(APP):v$(VERSION) quay.io/sergey_grebenshchikov/$(APP):latest
+ docker push quay.io/sergey_grebenshchikov/$(APP):latest
+
+clean:
+ rm -rf binaries/
+ rm -rf release/
+
release: zip
git push
hub release delete $(VERSION) || true
- hub release create $(VERSION) -m "$(VERSION)" -a release/$(APP)_$(VERSION)_osx_x86_64.zip -a release/$(APP)_$(VERSION)_windows_x86_64.zip -a release/$(APP)_$(VERSION)_linux_x86_64.zip
+ hub release create $(VERSION) -m "$(VERSION)" -a release/$(APP)_$(VERSION)_osx_x86_64.zip -a release/$(APP)_$(VERSION)_windows_x86_64.zip -a release/$(APP)_$(VERSION)_linux_x86_64.zip -a release/$(APP)_$(VERSION)_osx_x86_32.zip -a release/$(APP)_$(VERSION)_windows_x86_32.zip -a release/$(APP)_$(VERSION)_linux_x86_32.zip -a release/$(APP)_$(VERSION)_linux_arm64.zip
docker: binaries/linux_x86_64/$(APP)
docker build -t quay.io/sergey_grebenshchikov/$(APP):v$(VERSION) .
docker push quay.io/sergey_grebenshchikov/$(APP):v$(VERSION)
-docker-latest: docker
- docker tag quay.io/sergey_grebenshchikov/$(APP):v$(VERSION) quay.io/sergey_grebenshchikov/$(APP):latest
- docker push quay.io/sergey_grebenshchikov/$(APP):latest
+zip: release/$(APP)_$(VERSION)_osx_x86_64.zip release/$(APP)_$(VERSION)_windows_x86_64.zip release/$(APP)_$(VERSION)_linux_x86_64.zip release/$(APP)_$(VERSION)_osx_x86_32.zip release/$(APP)_$(VERSION)_windows_x86_32.zip release/$(APP)_$(VERSION)_linux_x86_32.zip release/$(APP)_$(VERSION)_linux_arm64.zip
-zip: release/$(APP)_$(VERSION)_osx_x86_64.zip release/$(APP)_$(VERSION)_windows_x86_64.zip release/$(APP)_$(VERSION)_linux_x86_64.zip
-
-binaries: binaries/osx_x86_64/$(APP) binaries/windows_x86_64/$(APP).exe binaries/linux_x86_64/$(APP)
-
-clean:
- rm -rf binaries/
- rm -rf release/
+binaries: binaries/osx_x86_64/$(APP) binaries/windows_x86_64/$(APP).exe binaries/linux_x86_64/$(APP) binaries/osx_x86_32/$(APP) binaries/windows_x86_32/$(APP).exe binaries/linux_x86_32/$(APP)
release/$(APP)_$(VERSION)_osx_x86_64.zip: binaries/osx_x86_64/$(APP)
mkdir -p release
@@ -49,3 +50,31 @@ release/$(APP)_$(VERSION)_linux_x86_64.zip: binaries/linux_x86_64/$(APP)
binaries/linux_x86_64/$(APP): $(GOFILES)
GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=$(VERSION)" -o binaries/linux_x86_64/$(APP) ./cmd/$(APP)
+
+release/$(APP)_$(VERSION)_osx_x86_32.zip: binaries/osx_x86_32/$(APP)
+ mkdir -p release
+ cd ./binaries/osx_x86_32 && zip -r -D ../../release/$(APP)_$(VERSION)_osx_x86_32.zip $(APP)
+
+binaries/osx_x86_32/$(APP): $(GOFILES)
+ GOOS=darwin GOARCH=386 go build -ldflags "-X main.version=$(VERSION)" -o binaries/osx_x86_32/$(APP) ./cmd/$(APP)
+
+release/$(APP)_$(VERSION)_windows_x86_32.zip: binaries/windows_x86_32/$(APP).exe
+ mkdir -p release
+ cd ./binaries/windows_x86_32 && zip -r -D ../../release/$(APP)_$(VERSION)_windows_x86_32.zip $(APP).exe
+
+binaries/windows_x86_32/$(APP).exe: $(GOFILES)
+ GOOS=windows GOARCH=386 go build -ldflags "-X main.version=$(VERSION)" -o binaries/windows_x86_32/$(APP).exe ./cmd/$(APP)
+
+release/$(APP)_$(VERSION)_linux_x86_32.zip: binaries/linux_x86_32/$(APP)
+ mkdir -p release
+ cd ./binaries/linux_x86_32 && zip -r -D ../../release/$(APP)_$(VERSION)_linux_x86_32.zip $(APP)
+
+binaries/linux_x86_32/$(APP): $(GOFILES)
+ GOOS=linux GOARCH=386 go build -ldflags "-X main.version=$(VERSION)" -o binaries/linux_x86_32/$(APP) ./cmd/$(APP)
+
+release/$(APP)_$(VERSION)_linux_arm64.zip: binaries/linux_arm64/$(APP)
+ mkdir -p release
+ cd ./binaries/linux_arm64 && zip -r -D ../../release/$(APP)_$(VERSION)_linux_arm64.zip $(APP)
+
+binaries/linux_arm64/$(APP): $(GOFILES)
+ GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=$(VERSION)" -o binaries/linux_arm64/$(APP) ./cmd/$(APP)
diff --git a/README.md b/README.md
index 598c710..3e701ed 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ Dead simple terminal plots from JSON data. Bar charts and line charts are suppor
- [Get it](#get-it)
- [Use it](#use-it)
- [Examples](#examples)
+ - [Screenshots](#screenshots)
- [Bar chart](#bar-chart)
- [Separate X and Y values](#separate-x-and-y-values)
- [XY pairs](#xy-pairs)
@@ -29,16 +30,16 @@ Or [download the binary](https://github.com/sgreben/jp/releases/latest) from the
```bash
# Linux
-curl -LO https://github.com/sgreben/jp/releases/download/1.0.0/jp_1.0.0_linux_x86_64.zip
-unzip jp_1.0.0_linux_x86_64.zip
+curl -LO https://github.com/sgreben/jp/releases/download/1.0.1/jp_1.0.1_linux_x86_64.zip
+unzip jp_1.0.1_linux_x86_64.zip
# OS X
-curl -LO https://github.com/sgreben/jp/releases/download/1.0.0/jp_1.0.0_osx_x86_64.zip
-unzip jp_1.0.0_osx_x86_64.zip
+curl -LO https://github.com/sgreben/jp/releases/download/1.0.1/jp_1.0.1_osx_x86_64.zip
+unzip jp_1.0.1_osx_x86_64.zip
# Windows
-curl -LO https://github.com/sgreben/jp/releases/download/1.0.0/jp_1.0.0_windows_x86_64.zip
-unzip jp_1.0.0_windows_x86_64.zip
+curl -LO https://github.com/sgreben/jp/releases/download/1.0.1/jp_1.0.1_windows_x86_64.zip
+unzip jp_1.0.1_windows_x86_64.zip
```
## Use it
@@ -63,6 +64,13 @@ Usage of jp:
## Examples
+### Screenshots
+
+In case you're on mobile, here's some PNGs of what `jp` output looks like:
+
+- ![Bar chart](docs/bar_chart.png)
+- ![Line chart](docs/line_chart.png)
+
### Bar chart
#### Separate X and Y values
diff --git a/cmd/jp/bar.go b/cmd/jp/bar.go
index be0c230..e1a622b 100644
--- a/cmd/jp/bar.go
+++ b/cmd/jp/bar.go
@@ -11,14 +11,18 @@ import (
func barPlotData(xvv, yvv [][]reflect.Value) (x []string, y []float64) {
for _, xv := range xvv {
for i := range xv {
- x = append(x, fmt.Sprint(xv[i].Interface()))
+ if xv[i].IsValid() && xv[i].CanInterface() {
+ x = append(x, fmt.Sprint(xv[i].Interface()))
+ }
}
}
for _, yv := range yvv {
for i := range yv {
- yvi, ok := yv[i].Interface().(float64)
- if ok {
- y = append(y, yvi)
+ if yv[i].IsValid() && yv[i].CanInterface() {
+ yvi, ok := yv[i].Interface().(float64)
+ if ok {
+ y = append(y, yvi)
+ }
}
}
}
diff --git a/cmd/jp/line.go b/cmd/jp/line.go
index 6b75a8f..b47b38c 100644
--- a/cmd/jp/line.go
+++ b/cmd/jp/line.go
@@ -10,17 +10,21 @@ import (
func linePlotData(xvv, yvv [][]reflect.Value) (x, y []float64) {
for _, xv := range xvv {
for i := range xv {
- xvi, ok := xv[i].Interface().(float64)
- if ok {
- x = append(x, xvi)
+ if xv[i].IsValid() && xv[i].CanInterface() {
+ xvi, ok := xv[i].Interface().(float64)
+ if ok {
+ x = append(x, xvi)
+ }
}
}
}
for _, yv := range yvv {
for i := range yv {
- yvi, ok := yv[i].Interface().(float64)
- if ok {
- y = append(y, yvi)
+ if yv[i].IsValid() && yv[i].CanInterface() {
+ yvi, ok := yv[i].Interface().(float64)
+ if ok {
+ y = append(y, yvi)
+ }
}
}
}
diff --git a/docs/bar_chart.png b/docs/bar_chart.png
new file mode 100644
index 0000000..7d47f2a
--- /dev/null
+++ b/docs/bar_chart.png
Binary files differ
diff --git a/docs/line_chart.png b/docs/line_chart.png
new file mode 100644
index 0000000..6c168a3
--- /dev/null
+++ b/docs/line_chart.png
Binary files differ