1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00
This commit is contained in:
Mike Farah
2020-12-28 23:01:13 +11:00
parent 94a563dfd8
commit f46c60f74d
6 changed files with 172 additions and 0 deletions

38
pkg/yqlib/doc/Keys.md Normal file
View 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
```