From 9509831cffc9dac24ed9a954ca9001f456a8cf88 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Tue, 29 Dec 2020 22:32:06 +1100 Subject: [PATCH] Updated docs --- pkg/yqlib/doc/Document Index.md | 4 ++-- pkg/yqlib/doc/Style.md | 2 +- pkg/yqlib/operator_document_index_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/yqlib/doc/Document Index.md b/pkg/yqlib/doc/Document Index.md index 948e50e4..8268b77c 100644 --- a/pkg/yqlib/doc/Document Index.md +++ b/pkg/yqlib/doc/Document Index.md @@ -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 diff --git a/pkg/yqlib/doc/Style.md b/pkg/yqlib/doc/Style.md index 8f6c09c1..50cfb9d3 100644 --- a/pkg/yqlib/doc/Style.md +++ b/pkg/yqlib/doc/Style.md @@ -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 diff --git a/pkg/yqlib/operator_document_index_test.go b/pkg/yqlib/operator_document_index_test.go index 0f0a3088..81898ed2 100644 --- a/pkg/yqlib/operator_document_index_test.go +++ b/pkg/yqlib/operator_document_index_test.go @@ -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",