mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Added snake_case version of camelCase operators (snake case now prefered)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user