Skip to content

Commit

Permalink
Merge pull request #1 from lafrenierejm/json-number
Browse files Browse the repository at this point in the history
Support duplicate numeric values
  • Loading branch information
lafrenierejm authored Jul 7, 2023
2 parents b6acc94 + 4feeca8 commit 28ca79c
Show file tree
Hide file tree
Showing 15 changed files with 371 additions and 2,801 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*.json]
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"line-length": false,
"no-inline-html": false
"line-length": false,
"no-inline-html": false
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ json.likes[2] = "meat";
```

> **Note** that the array indices jump directly from 0 to 2 because we're excluding the `"cheese"` value via `grep -v`.
Now add `gron --ungron` to the end of the above pipeline to get JSON output:

```console
Expand Down Expand Up @@ -285,7 +285,7 @@ There are a lot of people who work with JSON who don't have PHP installed.

### Why shouldn't I just use `jq`?

[`jq`](https://stedolan.github.io/jq/) is *awesome*, and a lot more powerful than gron, but with that power comes complexity.
[`jq`](https://stedolan.github.io/jq/) is _awesome_, and a lot more powerful than gron, but with that power comes complexity.
`gron` aims to make it easier to use the tools you already know, like `grep` and `sed`.

`gron`'s primary purpose is to make it easy to find the path to a value in a deeply nested JSON blob when you don't already know the structure;
Expand Down
21 changes: 10 additions & 11 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>gron</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>gron</h1>
Expand All @@ -20,28 +20,27 @@ <h2>Ungron Input Grammar</h2>
</pre>

<h3>Input</h3>
<img src="images/input.png">
<img src="images/input.png" />

<h3>Statement</h3>
<img src="images/statement.png">
<img src="images/statement.png" />

<h3>Path</h3>
<img src="images/path.png">
<img src="images/path.png" />

<h3>Value</h3>
<img src="images/value.png">
<img src="images/value.png" />

<h3>BareWord</h3>
<img src="images/bareword.png">
<img src="images/bareword.png" />

<h3>Key</h3>
<img src="images/key.png">
<img src="images/key.png" />

<h3>String</h3>
<img src="images/string.png">
<img src="images/string.png" />

<h3>UnescapedRune</h3>
<img src="images/unescapedrune.png">

<img src="images/unescapedrune.png" />
</body>
</html>
10 changes: 10 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@
gofmt.enable = true;
prettier.enable = true;
};
settings.formatter = {
prettier = {
excludes = [
"testdata/large-line.json"
"testdata/long-stream.json"
"testdata/scalar-stream.json"
"testdata/stream.json"
];
};
};
};

pre-commit = {
Expand Down
1 change: 1 addition & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func TestUngron(t *testing.T) {
{"testdata/grep-separators.gron", "testdata/grep-separators.json"},
{"testdata/github.gron", "testdata/github.json"},
{"testdata/large-line.gron", "testdata/large-line.json"},
{"testdata/duplicate-numeric.gron", "testdata/duplicate-numeric.json"},
}

for _, c := range cases {
Expand Down
Loading

0 comments on commit 28ca79c

Please sign in to comment.