Updated docs

This commit is contained in:
Mike Farah 2020-12-29 22:32:06 +11:00
parent e92180e89d
commit 9509831cff
3 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ a: frog
```
then
```bash
yq eval 'select(. | documentIndex == 1)' sample.yml
yq eval 'select(documentIndex == 1)' sample.yml
```
will output
```yaml
@ -42,7 +42,7 @@ a: frog
```
then
```bash
yq eval '.a | ({"match": ., "doc": (. | documentIndex)})' sample.yml
yq eval '.a | ({"match": ., "doc": documentIndex})' sample.yml
```
will output
```yaml

View File

@ -146,7 +146,7 @@ will output
```
## Pretty print
Set empty (default) quote style, note the usage of `...` to match keys too.
Set empty (default) quote style, note the usage of `...` to match keys too. Note that there is a `--prettyPrint/-P` short flag for this.
Given a sample.yml file of:
```yaml

View File

@ -17,7 +17,7 @@ var documentIndexScenarios = []expressionScenario{
{
description: "Filter by document index",
document: "a: cat\n---\na: frog\n",
expression: `select(. | documentIndex == 1)`,
expression: `select(documentIndex == 1)`,
expected: []string{
"D1, P[], (doc)::a: frog\n",
},
@ -25,7 +25,7 @@ var documentIndexScenarios = []expressionScenario{
{
description: "Print Document Index with matches",
document: "a: cat\n---\na: frog\n",
expression: `.a | ({"match": ., "doc": (. | documentIndex)})`,
expression: `.a | ({"match": ., "doc": documentIndex})`,
expected: []string{
"D0, P[], (!!map)::match: cat\ndoc: 0\n",
"D0, P[], (!!map)::match: frog\ndoc: 1\n",