mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Fixing omit docs
This commit is contained in:
parent
19a0e6dd8b
commit
021d5f05f9
3
pkg/yqlib/doc/operators/headers/omit.md
Normal file
3
pkg/yqlib/doc/operators/headers/omit.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Omit
|
||||||
|
|
||||||
|
Works like `pick`, but instead you specify the keys/indices that you _don't_ want included.
|
@ -1,6 +1,9 @@
|
|||||||
|
# Omit
|
||||||
|
|
||||||
|
Works like `pick`, but instead you specify the keys/indices that you _don't_ want included.
|
||||||
|
|
||||||
## Omit keys from map
|
## Omit keys from map
|
||||||
Note that the order of the keys matches the omit order and non existent keys are skipped.
|
Note that non existent keys are skipped.
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
@ -22,7 +25,7 @@ myMap:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Omit indices from array
|
## Omit indices from array
|
||||||
Note that the order of the indices matches the omit order and non existent indices are skipped.
|
Note that non existent indices are skipped.
|
||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
var omitOperatorScenarios = []expressionScenario{
|
var omitOperatorScenarios = []expressionScenario{
|
||||||
{
|
{
|
||||||
description: "Omit keys from map",
|
description: "Omit keys from map",
|
||||||
subdescription: "Note that the order of the keys matches the omit order and non existent keys are skipped.",
|
subdescription: "Note that non existent keys are skipped.",
|
||||||
document: "myMap: {cat: meow, dog: bark, thing: hamster, hamster: squeak}\n",
|
document: "myMap: {cat: meow, dog: bark, thing: hamster, hamster: squeak}\n",
|
||||||
expression: `.myMap |= omit(["hamster", "cat", "goat"])`,
|
expression: `.myMap |= omit(["hamster", "cat", "goat"])`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
@ -34,7 +34,7 @@ var omitOperatorScenarios = []expressionScenario{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Omit indices from array",
|
description: "Omit indices from array",
|
||||||
subdescription: "Note that the order of the indices matches the omit order and non existent indices are skipped.",
|
subdescription: "Note that non existent indices are skipped.",
|
||||||
document: `[cat, leopard, lion]`,
|
document: `[cat, leopard, lion]`,
|
||||||
expression: `omit([2, 0, 734, -5])`,
|
expression: `omit([2, 0, 734, -5])`,
|
||||||
expected: []string{
|
expected: []string{
|
||||||
|
Loading…
Reference in New Issue
Block a user