Added snake_case version of camelCase operators (snake case now prefered)

This commit is contained in:
Mike Farah
2022-02-11 09:05:17 +11:00
parent a9c3617b4f
commit a5f6a80cf6
9 changed files with 48 additions and 38 deletions
+9 -9
View File
@@ -23,7 +23,7 @@ a: cat
```
then
```bash
yq '.a lineComment="single"' sample.yml
yq '.a line_comment="single"' sample.yml
```
will output
```yaml
@@ -38,7 +38,7 @@ b: dog
```
then
```bash
yq '.. lineComment |= .' sample.yml
yq '.. line_comment |= .' sample.yml
```
will output
```yaml
@@ -53,7 +53,7 @@ a: cat
```
then
```bash
yq '. headComment="single"' sample.yml
yq '. head_comment="single"' sample.yml
```
will output
```yaml
@@ -69,7 +69,7 @@ a: cat
```
then
```bash
yq '. footComment=.a' sample.yml
yq '. foot_comment=.a' sample.yml
```
will output
```yaml
@@ -86,7 +86,7 @@ b: dog # leave this
```
then
```bash
yq '.a lineComment=""' sample.yml
yq '.a line_comment=""' sample.yml
```
will output
```yaml
@@ -120,7 +120,7 @@ a: cat # meow
```
then
```bash
yq '.a | lineComment' sample.yml
yq '.a | line_comment' sample.yml
```
will output
```yaml
@@ -138,7 +138,7 @@ a: cat # meow
```
then
```bash
yq '. | headComment' sample.yml
yq '. | head_comment' sample.yml
```
will output
```yaml
@@ -157,7 +157,7 @@ a: cat # meow
```
then
```bash
yq 'headComment' sample.yml
yq 'head_comment' sample.yml
```
will output
```yaml
@@ -177,7 +177,7 @@ a: cat # meow
```
then
```bash
yq '. | footComment' sample.yml
yq '. | foot_comment' sample.yml
```
will output
```yaml
+3 -3
View File
@@ -17,7 +17,7 @@ a: frog
```
then
```bash
yq '.a | documentIndex' sample.yml
yq '.a | document_index' sample.yml
```
will output
```yaml
@@ -53,7 +53,7 @@ a: frog
```
then
```bash
yq 'select(documentIndex == 1)' sample.yml
yq 'select(document_index == 1)' sample.yml
```
will output
```yaml
@@ -85,7 +85,7 @@ a: frog
```
then
```bash
yq '.a | ({"match": ., "doc": documentIndex})' sample.yml
yq '.a | ({"match": ., "doc": document_index})' sample.yml
```
will output
```yaml
+2 -2
View File
@@ -37,7 +37,7 @@ a: cat
```
then
```bash
yq 'fileIndex' sample.yml
yq 'file_index' sample.yml
```
will output
```yaml
@@ -55,7 +55,7 @@ a: cat
```
then
```bash
yq eval-all 'fileIndex' sample.yml another.yml
yq eval-all 'file_index' sample.yml another.yml
```
will output
```yaml
@@ -11,7 +11,7 @@ Note that versions prior to 4.18 require the 'eval/e' command to be specified.&#
## Split empty
Running
```bash
yq --null-input 'splitDoc'
yq --null-input 'split_doc'
```
will output
```yaml
@@ -26,7 +26,7 @@ Given a sample.yml file of:
```
then
```bash
yq '.[] | splitDoc' sample.yml
yq '.[] | split_doc' sample.yml
```
will output
```yaml