From dee592eb3b1bd6b5ff1e23a0075be2f312bd0e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20St=C3=A4bler?= Date: Tue, 24 May 2022 10:18:27 +0200 Subject: [PATCH] Fix typo (#1222) --- how-it-works.md | 4 ++-- pkg/yqlib/candidate_node.go | 2 +- pkg/yqlib/doc/operators/anchor-and-alias-operators.md | 2 +- pkg/yqlib/doc/operators/assign-update.md | 8 ++++---- pkg/yqlib/doc/operators/encode-decode.md | 2 +- pkg/yqlib/doc/operators/equals.md | 2 +- pkg/yqlib/doc/operators/eval.md | 2 +- .../doc/operators/headers/anchor-and-alias-operators.md | 2 +- pkg/yqlib/doc/operators/headers/encode-decode.md | 2 +- pkg/yqlib/doc/operators/headers/eval.md | 2 +- pkg/yqlib/doc/operators/headers/reduce.md | 2 +- pkg/yqlib/doc/operators/reduce.md | 2 +- pkg/yqlib/doc/operators/string-operators.md | 2 +- pkg/yqlib/doc/operators/variable-operators.md | 4 ++-- pkg/yqlib/operator_assign_test.go | 6 +++--- pkg/yqlib/operator_equals_test.go | 4 ++-- pkg/yqlib/operator_strings_test.go | 2 +- pkg/yqlib/operator_variables_test.go | 4 ++-- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/how-it-works.md b/how-it-works.md index d5cb5f9..ed7aa08 100644 --- a/how-it-works.md +++ b/how-it-works.md @@ -47,7 +47,7 @@ b: dog ## Complex assignment, operator precedence rules -Just like math expression - `yq` expression have an order of precedence. The pipe `|` operator has a low order of precedence, so operators with higher precedence will get evalated first. +Just like math expression - `yq` expression have an order of precedence. The pipe `|` operator has a low order of precedence, so operators with higher precedence will get evaluated first. Most of the time, this is intuitively what you'd want, for instance `.a = "cat" | .b = "dog"` is effectively: `(.a = "cat") | (.b = "dog")`. @@ -66,7 +66,7 @@ Lets say you had: Lets say you wanted to update the `sally` entry to have fruit: 'mango'. The _incorrect_ way to do that is: `.[] | select(.name == "sally") | .fruit = "mango"`. -Becasue `|` has a low operator precedence, this will be evaluated (_incorrectly_) as : `(.[]) | (select(.name == "sally")) | (.fruit = "mango")`. What you'll see is only the updated segment returned: +Because `|` has a low operator precedence, this will be evaluated (_incorrectly_) as : `(.[]) | (select(.name == "sally")) | (.fruit = "mango")`. What you'll see is only the updated segment returned: ```yaml name: sally diff --git a/pkg/yqlib/candidate_node.go b/pkg/yqlib/candidate_node.go index 019dd8a..26a8c63 100644 --- a/pkg/yqlib/candidate_node.go +++ b/pkg/yqlib/candidate_node.go @@ -21,7 +21,7 @@ type CandidateNode struct { Filename string FileIndex int // when performing op against all nodes given, this will treat all the nodes as one - // (e.g. top level cross document merge). This property does not propegate to child nodes. + // (e.g. top level cross document merge). This property does not propagate to child nodes. EvaluateTogether bool IsMapKey bool } diff --git a/pkg/yqlib/doc/operators/anchor-and-alias-operators.md b/pkg/yqlib/doc/operators/anchor-and-alias-operators.md index 08204a5..3e12bef 100644 --- a/pkg/yqlib/doc/operators/anchor-and-alias-operators.md +++ b/pkg/yqlib/doc/operators/anchor-and-alias-operators.md @@ -1,6 +1,6 @@ # Anchor and Alias Operators -Use the `alias` and `anchor` operators to read and write yaml aliases and anchors. The `explode` operator normalises a yaml file (dereference (or expands) aliases and remove anchor names). +Use the `alias` and `anchor` operators to read and write yaml aliases and anchors. The `explode` operator normalizes a yaml file (dereference (or expands) aliases and remove anchor names). `yq` supports merge aliases (like `<<: *blah`) however this is no longer in the standard yaml spec (1.2) and so `yq` will automatically add the `!!merge` tag to these nodes as it is effectively a custom tag. diff --git a/pkg/yqlib/doc/operators/assign-update.md b/pkg/yqlib/doc/operators/assign-update.md index ff6b086..ef97571 100644 --- a/pkg/yqlib/doc/operators/assign-update.md +++ b/pkg/yqlib/doc/operators/assign-update.md @@ -107,13 +107,13 @@ c: fieldC ``` then ```bash -yq '(.a, .c) = "potatoe"' sample.yml +yq '(.a, .c) = "potato"' sample.yml ``` will output ```yaml -a: potatoe +a: potato b: fieldB -c: potatoe +c: potato ``` ## Update string value @@ -151,7 +151,7 @@ a: ``` ## Update deeply selected results -Note that the LHS is wrapped in brackets! This is to ensure we dont first filter out the yaml and then update the snippet. +Note that the LHS is wrapped in brackets! This is to ensure we don't first filter out the yaml and then update the snippet. Given a sample.yml file of: ```yaml diff --git a/pkg/yqlib/doc/operators/encode-decode.md b/pkg/yqlib/doc/operators/encode-decode.md index ba90295..5332649 100644 --- a/pkg/yqlib/doc/operators/encode-decode.md +++ b/pkg/yqlib/doc/operators/encode-decode.md @@ -4,7 +4,7 @@ Encode operators will take the piped in object structure and encode it as a stri Note that you can optionally pass an indent value to the encode functions (see below). -These operators are useful to process yaml documents that have stringified embeded yaml/json/props in them. +These operators are useful to process yaml documents that have stringified embedded yaml/json/props in them. | Format | Decode (from string) | Encode (to string) | diff --git a/pkg/yqlib/doc/operators/equals.md b/pkg/yqlib/doc/operators/equals.md index e1686e9..95cef41 100644 --- a/pkg/yqlib/doc/operators/equals.md +++ b/pkg/yqlib/doc/operators/equals.md @@ -81,7 +81,7 @@ true false ``` -## Dont match number +## Don't match number Given a sample.yml file of: ```yaml - 3 diff --git a/pkg/yqlib/doc/operators/eval.md b/pkg/yqlib/doc/operators/eval.md index eae33bd..c7699d2 100644 --- a/pkg/yqlib/doc/operators/eval.md +++ b/pkg/yqlib/doc/operators/eval.md @@ -4,7 +4,7 @@ Use `eval` to dynamically process an expression - for instance from an environme `eval` takes a single argument, and evaluates that as a `yq` expression. Any valid expression can be used, beit a path `.a.b.c | select(. == "cat")`, or an update `.a.b.c = "gogo"`. -Tip: This can be useful way parameterise complex scripts. +Tip: This can be useful way parameterize complex scripts. {% hint style="warning" %} Note that versions prior to 4.18 require the 'eval/e' command to be specified. diff --git a/pkg/yqlib/doc/operators/headers/anchor-and-alias-operators.md b/pkg/yqlib/doc/operators/headers/anchor-and-alias-operators.md index 5c6f29e..13466f1 100644 --- a/pkg/yqlib/doc/operators/headers/anchor-and-alias-operators.md +++ b/pkg/yqlib/doc/operators/headers/anchor-and-alias-operators.md @@ -1,6 +1,6 @@ # Anchor and Alias Operators -Use the `alias` and `anchor` operators to read and write yaml aliases and anchors. The `explode` operator normalises a yaml file (dereference (or expands) aliases and remove anchor names). +Use the `alias` and `anchor` operators to read and write yaml aliases and anchors. The `explode` operator normalizes a yaml file (dereference (or expands) aliases and remove anchor names). `yq` supports merge aliases (like `<<: *blah`) however this is no longer in the standard yaml spec (1.2) and so `yq` will automatically add the `!!merge` tag to these nodes as it is effectively a custom tag. diff --git a/pkg/yqlib/doc/operators/headers/encode-decode.md b/pkg/yqlib/doc/operators/headers/encode-decode.md index 1099ad7..07aa47e 100644 --- a/pkg/yqlib/doc/operators/headers/encode-decode.md +++ b/pkg/yqlib/doc/operators/headers/encode-decode.md @@ -4,7 +4,7 @@ Encode operators will take the piped in object structure and encode it as a stri Note that you can optionally pass an indent value to the encode functions (see below). -These operators are useful to process yaml documents that have stringified embeded yaml/json/props in them. +These operators are useful to process yaml documents that have stringified embedded yaml/json/props in them. | Format | Decode (from string) | Encode (to string) | diff --git a/pkg/yqlib/doc/operators/headers/eval.md b/pkg/yqlib/doc/operators/headers/eval.md index 45c1a22..cb834d6 100644 --- a/pkg/yqlib/doc/operators/headers/eval.md +++ b/pkg/yqlib/doc/operators/headers/eval.md @@ -4,4 +4,4 @@ Use `eval` to dynamically process an expression - for instance from an environme `eval` takes a single argument, and evaluates that as a `yq` expression. Any valid expression can be used, beit a path `.a.b.c | select(. == "cat")`, or an update `.a.b.c = "gogo"`. -Tip: This can be useful way parameterise complex scripts. +Tip: This can be useful way parameterize complex scripts. diff --git a/pkg/yqlib/doc/operators/headers/reduce.md b/pkg/yqlib/doc/operators/headers/reduce.md index 0338664..4020ae8 100644 --- a/pkg/yqlib/doc/operators/headers/reduce.md +++ b/pkg/yqlib/doc/operators/headers/reduce.md @@ -19,4 +19,4 @@ On the RHS there is ``, the starting value of the accumulator and ` ## yq vs jq syntax Reduce syntax in `yq` is a little different from `jq` - as `yq` (currently) isn't as sophisticated as `jq` and its only supports infix notation (e.g. a + b, where the operator is in the middle of the two parameters) - where as `jq` uses a mix of infix notation with _prefix_ notation (e.g. `reduce a b` is like writing `+ a b`). -To that end, the reduce operator is called `ireduce` for backwards compatability if a `jq` like prefix version of `reduce` is ever added. +To that end, the reduce operator is called `ireduce` for backwards compatibility if a `jq` like prefix version of `reduce` is ever added. diff --git a/pkg/yqlib/doc/operators/reduce.md b/pkg/yqlib/doc/operators/reduce.md index 37b2164..e06a2a2 100644 --- a/pkg/yqlib/doc/operators/reduce.md +++ b/pkg/yqlib/doc/operators/reduce.md @@ -19,7 +19,7 @@ On the RHS there is ``, the starting value of the accumulator and ` ## yq vs jq syntax Reduce syntax in `yq` is a little different from `jq` - as `yq` (currently) isn't as sophisticated as `jq` and its only supports infix notation (e.g. a + b, where the operator is in the middle of the two parameters) - where as `jq` uses a mix of infix notation with _prefix_ notation (e.g. `reduce a b` is like writing `+ a b`). -To that end, the reduce operator is called `ireduce` for backwards compatability if a `jq` like prefix version of `reduce` is ever added. +To that end, the reduce operator is called `ireduce` for backwards compatibility if a `jq` like prefix version of `reduce` is ever added. {% hint style="warning" %} Note that versions prior to 4.18 require the 'eval/e' command to be specified. diff --git a/pkg/yqlib/doc/operators/string-operators.md b/pkg/yqlib/doc/operators/string-operators.md index 14dfc50..9f0f322 100644 --- a/pkg/yqlib/doc/operators/string-operators.md +++ b/pkg/yqlib/doc/operators/string-operators.md @@ -266,7 +266,7 @@ will output ``` ## Test using regex -Like jq'q equivalent, this works like match but only returns true/false instead of full match details +Like jq's equivalent, this works like match but only returns true/false instead of full match details Given a sample.yml file of: ```yaml diff --git a/pkg/yqlib/doc/operators/variable-operators.md b/pkg/yqlib/doc/operators/variable-operators.md index b06458f..e7efcd0 100644 --- a/pkg/yqlib/doc/operators/variable-operators.md +++ b/pkg/yqlib/doc/operators/variable-operators.md @@ -46,7 +46,7 @@ Example taken from [jq](https://stedolan.github.io/jq/manual/#Variable/SymbolicB Given a sample.yml file of: ```yaml "posts": - - "title": Frist psot + - "title": First post "author": anon - "title": A well-written article "author": person1 @@ -60,7 +60,7 @@ yq '.realnames as $names | .posts[] | {"title":.title, "author": $names[.author] ``` will output ```yaml -title: Frist psot +title: First post author: Anonymous Coward title: A well-written article author: Person McPherson diff --git a/pkg/yqlib/operator_assign_test.go b/pkg/yqlib/operator_assign_test.go index 8b28c7b..052be8b 100644 --- a/pkg/yqlib/operator_assign_test.go +++ b/pkg/yqlib/operator_assign_test.go @@ -101,9 +101,9 @@ var assignOperatorScenarios = []expressionScenario{ { description: "Updated multiple paths", document: `{a: fieldA, b: fieldB, c: fieldC}`, - expression: `(.a, .c) = "potatoe"`, + expression: `(.a, .c) = "potato"`, expected: []string{ - "D0, P[], (doc)::{a: potatoe, b: fieldB, c: potatoe}\n", + "D0, P[], (doc)::{a: potato, b: fieldB, c: potato}\n", }, }, { @@ -149,7 +149,7 @@ var assignOperatorScenarios = []expressionScenario{ }, { description: "Update deeply selected results", - subdescription: "Note that the LHS is wrapped in brackets! This is to ensure we dont first filter out the yaml and then update the snippet.", + subdescription: "Note that the LHS is wrapped in brackets! This is to ensure we don't first filter out the yaml and then update the snippet.", document: `{a: {b: apple, c: cactus}}`, expression: `(.a[] | select(. == "apple")) = "frog"`, expected: []string{ diff --git a/pkg/yqlib/operator_equals_test.go b/pkg/yqlib/operator_equals_test.go index 517dae3..70b9f88 100644 --- a/pkg/yqlib/operator_equals_test.go +++ b/pkg/yqlib/operator_equals_test.go @@ -130,7 +130,7 @@ var equalsOperatorScenarios = []expressionScenario{ }, }, { - description: "Dont match number", + description: "Don't match number", document: `[3, 4, 5]`, expression: `.[] | (. != 4)`, expected: []string{ @@ -165,7 +165,7 @@ var equalsOperatorScenarios = []expressionScenario{ }, }, { - description: "Non exisitant key doesn't equal a value", + description: "Non existent key doesn't equal a value", document: "a: frog", expression: `select(.b != "thing")`, expected: []string{ diff --git a/pkg/yqlib/operator_strings_test.go b/pkg/yqlib/operator_strings_test.go index 04c49f7..07b27c0 100644 --- a/pkg/yqlib/operator_strings_test.go +++ b/pkg/yqlib/operator_strings_test.go @@ -165,7 +165,7 @@ var stringsOperatorScenarios = []expressionScenario{ }, { description: "Test using regex", - subdescription: "Like jq'q equivalent, this works like match but only returns true/false instead of full match details", + subdescription: "Like jq's equivalent, this works like match but only returns true/false instead of full match details", document: `["cat", "dog"]`, expression: `.[] | test("at")`, expected: []string{ diff --git a/pkg/yqlib/operator_variables_test.go b/pkg/yqlib/operator_variables_test.go index ad27949..7ab9ee3 100644 --- a/pkg/yqlib/operator_variables_test.go +++ b/pkg/yqlib/operator_variables_test.go @@ -39,13 +39,13 @@ var variableOperatorScenarios = []expressionScenario{ { description: "Using variables as a lookup", subdescription: "Example taken from [jq](https://stedolan.github.io/jq/manual/#Variable/SymbolicBindingOperator:...as$identifier|...)", - document: `{"posts": [{"title": "Frist psot", "author": "anon"}, + document: `{"posts": [{"title": "First post", "author": "anon"}, {"title": "A well-written article", "author": "person1"}], "realnames": {"anon": "Anonymous Coward", "person1": "Person McPherson"}}`, expression: `.realnames as $names | .posts[] | {"title":.title, "author": $names[.author]}`, expected: []string{ - "D0, P[], (!!map)::title: \"Frist psot\"\nauthor: \"Anonymous Coward\"\n", + "D0, P[], (!!map)::title: \"First post\"\nauthor: \"Anonymous Coward\"\n", "D0, P[], (!!map)::title: \"A well-written article\"\nauthor: \"Person McPherson\"\n", }, },