mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
wip
This commit is contained in:
38
pkg/yqlib/doc/Keys.md
Normal file
38
pkg/yqlib/doc/Keys.md
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
## Get Keys
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
a:
|
||||
b: cat
|
||||
c: dog
|
||||
d: frog
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq eval '.a | keys' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
3
|
||||
```
|
||||
|
||||
## Set key style
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
a:
|
||||
b: cat
|
||||
c: dog
|
||||
d: frog
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq eval '(.a | keys) style = 'single'' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
a:
|
||||
b: cat
|
||||
c: dog
|
||||
d: frog
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user