mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-04 00:14:55 +08:00
Updating docs
This commit is contained in:
@@ -13,7 +13,7 @@ Given a sample.json file of:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -P '.' sample.json
|
||||
yq -P '.' sample.json
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -29,7 +29,7 @@ Given a sample.json file of:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -P '.' sample.json
|
||||
yq -P '.' sample.json
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -48,7 +48,7 @@ cat: meow
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=json '.' sample.yml
|
||||
yq -o=json '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```json
|
||||
@@ -64,7 +64,7 @@ cat: meow # this is a comment, and it will be dropped.
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=json -I=0 '.' sample.yml
|
||||
yq -o=json -I=0 '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```json
|
||||
@@ -78,7 +78,7 @@ cat: meow # this is a comment, and it will be dropped.
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=json '.' sample.yml
|
||||
yq -o=json '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```json
|
||||
@@ -97,7 +97,7 @@ anotherCat: *ref
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=json '.' sample.yml
|
||||
yq -o=json '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```json
|
||||
@@ -116,7 +116,7 @@ things: [{stuff: cool}, {whatever: cat}]
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=json -I=0 '.things[]' sample.yml
|
||||
yq -o=json -I=0 '.things[]' sample.yml
|
||||
```
|
||||
will output
|
||||
```json
|
||||
|
||||
+12
-12
@@ -20,7 +20,7 @@ Given a sample.xml file of:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -p=xml '.' sample.xml
|
||||
yq -p=xml '.' sample.xml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -44,7 +44,7 @@ Given a sample.xml file of:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -p=xml ' (.. | select(tag == "!!str")) |= from_yaml' sample.xml
|
||||
yq -p=xml ' (.. | select(tag == "!!str")) |= from_yaml' sample.xml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -65,7 +65,7 @@ Given a sample.xml file of:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -p=xml '.' sample.xml
|
||||
yq -p=xml '.' sample.xml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -86,7 +86,7 @@ Given a sample.xml file of:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -p=xml '.' sample.xml
|
||||
yq -p=xml '.' sample.xml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -105,7 +105,7 @@ Given a sample.xml file of:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -p=xml '.' sample.xml
|
||||
yq -p=xml '.' sample.xml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -140,7 +140,7 @@ for x --></x>
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -p=xml '.' sample.xml
|
||||
yq -p=xml '.' sample.xml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
@@ -168,7 +168,7 @@ cat: purrs
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=xml '.' sample.yml
|
||||
yq -o=xml '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```xml
|
||||
@@ -185,7 +185,7 @@ pets:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=xml '.' sample.yml
|
||||
yq -o=xml '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```xml
|
||||
@@ -207,7 +207,7 @@ cat:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=xml '.' sample.yml
|
||||
yq -o=xml '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```xml
|
||||
@@ -228,7 +228,7 @@ cat:
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=xml '.' sample.yml
|
||||
yq -o=xml '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```xml
|
||||
@@ -252,7 +252,7 @@ cat: # inline_cat
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -o=xml '.' sample.yml
|
||||
yq -o=xml '.' sample.yml
|
||||
```
|
||||
will output
|
||||
```xml
|
||||
@@ -288,7 +288,7 @@ for x --></x>
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq e -p=xml -o=xml '.' sample.xml
|
||||
yq -p=xml -o=xml '.' sample.xml
|
||||
```
|
||||
will output
|
||||
```xml
|
||||
|
||||
Reference in New Issue
Block a user