mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-10 08:35:42 +00:00
Clarify use of brackets when reading with special characters
This commit is contained in:
parent
d26dad7117
commit
0e3787032c
@ -51,7 +51,7 @@ will output
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Special characters
|
## Special characters
|
||||||
Use quotes with brackets around path elements with special characters
|
Use quotes with square brackets around path elements with special characters
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@ -83,7 +83,7 @@ apple
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Keys with spaces
|
## Keys with spaces
|
||||||
Use quotes with brackets around path elements with special characters
|
Use quotes with square brackets around path elements with special characters
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@ -116,7 +116,7 @@ var traversePathOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Special characters",
|
description: "Special characters",
|
||||||
subdescription: "Use quotes with brackets around path elements with special characters",
|
subdescription: "Use quotes with square brackets around path elements with special characters",
|
||||||
document: `{"{}": frog}`,
|
document: `{"{}": frog}`,
|
||||||
expression: `.["{}"]`,
|
expression: `.["{}"]`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -133,7 +133,7 @@ var traversePathOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Keys with spaces",
|
description: "Keys with spaces",
|
||||||
subdescription: "Use quotes with brackets around path elements with special characters",
|
subdescription: "Use quotes with square brackets around path elements with special characters",
|
||||||
document: `{"red rabbit": frog}`,
|
document: `{"red rabbit": frog}`,
|
||||||
expression: `.["red rabbit"]`,
|
expression: `.["red rabbit"]`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user