Skip to content

Commit

Permalink
Rename project name
Browse files Browse the repository at this point in the history
  • Loading branch information
simeji committed Nov 13, 2016
1 parent 6e123b1 commit b9f6dd9
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 34 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ _testmain.go
*.test
test.*

# jig package
jig
# jid package
jid
*.out
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# jig
# jid
json interactive digger

It's very simple and pawerful tool.
You can drill down interactively by filtering query like [jq](https://stedolan.github.io/jq/)
You can drill down interactively by using filtering queries like [jq](https://stedolan.github.io/jq/).

## Demo

![demo-jig-main](https://github.com/simeji/jig/wiki/images/demo-jig-main-640.gif)
![demo-jid-main](https://github.com/simeji/jid/wiki/images/demo-jid-main-640.gif)

## Installation

### Just use "jig" command
### Simply use "jid" command

Please download binary from below
If you simply want to use `jid` command, please download binary from below.

https://github.com/simeji/jig/releases
https://github.com/simeji/jid/releases

### Build "jig" command by yourself
### Build "jid" command by yourself

Jig require some packages.
jid require some packages.
Please go get below packages.

[bitly/go-simplejson](https://github.com/bitly/go-simplejson)
Expand All @@ -32,15 +32,17 @@ Please go get below packages.

#### simple json example

Please execute the below command.

```
echo '{"aa":"2AA2","bb":{"aaa":[123,"cccc",[1,2]],"c":321}}'| jig
echo '{"aa":"2AA2","bb":{"aaa":[123,"cccc",[1,2]],"c":321}}'| jid
```

then, jig will be running.
then, jid will be running.

You can dig JSON data incrementally.

You input `.bb.aaa[2]` and you can see below.
When you enter `.bb.aaa[2]`, you will see the following.

```
[Filter]> .bb.aaa[2]
Expand All @@ -54,15 +56,17 @@ Then, you press Enter key and output `[1,2]` and exit.

#### simple json example2

This json is used by demo section.
This json is used by [demo section](https://github.com/simeji/jid#demo).
```
echo '{"info":{"date":"2016-10-23","version":1.0},"users":[{"name":"simeji","uri":"https://github.com/simeji","id":1},{"name":"simeji2","uri":"https://example.com/simeji","id":2},{"name":"simeji3","uri":"https://example.com/simeji3","id":3}],"userCount":3}}'|jig
echo '{"info":{"date":"2016-10-23","version":1.0},"users":[{"name":"simeji","uri":"https://github.com/simeji","id":1},{"name":"simeji2","uri":"https://example.com/simeji","id":2},{"name":"simeji3","uri":"https://example.com/simeji3","id":3}],"userCount":3}}'|jid
```

#### with curl

Sample for using [RDAP](https://datatracker.ietf.org/wg/weirds/documents/) data.

```
curl -s http://rdg.afilias.info/rdap/domain/example.info | jig
curl -s http://rdg.afilias.info/rdap/domain/example.info | jid
```

## Keymaps
Expand All @@ -71,6 +75,7 @@ curl -s http://rdg.afilias.info/rdap/domain/example.info | jig
|:-----------|:----------|
|`TAB` / `CTRL` + `I` |Show available items and choice them|
|`CTRL` + `W` |Delete from the cursor to the start of the word|
|`CTRL` + `W` |Delete from the cursor to the start of the word|
|`CTRL` + `F` / Right Arrow (:arrow_right:)|To the first character of the 'Filter'|
|`CTRL` + `B` / Left Arrow (:arrow_left:)|To the end of the 'Filter'|
|`CTRL` + `A`|To the first character of the 'Filter'|
Expand Down
6 changes: 3 additions & 3 deletions cmd/jig.go → cmd/jid.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"flag"
"fmt"
"github.com/simeji/jig"
"github.com/simeji/jid"
"os"
)

Expand All @@ -15,11 +15,11 @@ func main() {
flag.BoolVar(&query, "q", false, "output query")
flag.Parse()

e := jig.NewEngine(content)
e := jid.NewEngine(content)
os.Exit(run(e, query))
}

func run(e jig.EngineInterface, query bool) int {
func run(e jid.EngineInterface, query bool) int {

result := e.Run()
if result.GetError() != nil {
Expand Down
12 changes: 6 additions & 6 deletions cmd/jig_test.go → cmd/jid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"github.com/simeji/jig"
"github.com/simeji/jid"
"github.com/stretchr/testify/assert"
"os"
"testing"
Expand All @@ -16,7 +16,7 @@ func TestMain(m *testing.M) {
defer os.Exit(code)
}

func TestJigRun(t *testing.T) {
func TestjidRun(t *testing.T) {
var assert = assert.New(t)

e := &EngineMock{err: nil}
Expand All @@ -31,7 +31,7 @@ func TestJigRun(t *testing.T) {
assert.Zero(result)
}

func TestJigRunWithError(t *testing.T) {
func TestjidRunWithError(t *testing.T) {
called = 0
var assert = assert.New(t)
e := &EngineMock{err: fmt.Errorf("")}
Expand All @@ -42,11 +42,11 @@ func TestJigRunWithError(t *testing.T) {

type EngineMock struct{ err error }

func (e *EngineMock) Run() jig.EngineResultInterface {
func (e *EngineMock) Run() jid.EngineResultInterface {
return &EngineResultMock{err: e.err}
}
func (e *EngineMock) GetQuery() jig.QueryInterface {
return jig.NewQuery([]rune(""))
func (e *EngineMock) GetQuery() jid.QueryInterface {
return jid.NewQuery([]rune(""))
}

type EngineResultMock struct{ err error }
Expand Down
2 changes: 1 addition & 1 deletion engine.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"github.com/nsf/termbox-go"
Expand Down
2 changes: 1 addition & 1 deletion engine_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion json_manager.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"github.com/bitly/go-simplejson"
Expand Down
2 changes: 1 addition & 1 deletion json_manager_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion query.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"regexp"
Expand Down
2 changes: 1 addition & 1 deletion query_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion suggestion.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"github.com/bitly/go-simplejson"
Expand Down
2 changes: 1 addition & 1 deletion suggestion_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion terminal.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package jig
package jid

import (
"github.com/nsf/termbox-go"
Expand Down

0 comments on commit b9f6dd9

Please sign in to comment.