mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 17:36:59 +08:00
Added load_base64
This commit is contained in:
@@ -13,24 +13,37 @@ You can load files of the following supported types:
|
||||
| Properties | load_props |
|
||||
| Plain String | load_str |
|
||||
|
||||
Lets say there is a file `../../examples/thing.yml`:
|
||||
## Samples files for tests:
|
||||
|
||||
### yaml
|
||||
|
||||
`../../examples/thing.yml`:
|
||||
|
||||
```yaml
|
||||
a: apple is included
|
||||
b: cool
|
||||
```
|
||||
and a file `small.xml`:
|
||||
|
||||
### xml
|
||||
`small.xml`:
|
||||
|
||||
```xml
|
||||
<this>is some xml</this>
|
||||
```
|
||||
|
||||
and `small.properties`:
|
||||
### properties
|
||||
`small.properties`:
|
||||
|
||||
```properties
|
||||
this.is = a properties file
|
||||
```
|
||||
|
||||
### base64
|
||||
`base64.txt`:
|
||||
```
|
||||
bXkgc2VjcmV0IGNoaWxsaSByZWNpcGUgaXMuLi4u
|
||||
```
|
||||
|
||||
{% hint style="warning" %}
|
||||
Note that versions prior to 4.18 require the 'eval/e' command to be specified. 
|
||||
|
||||
@@ -169,3 +182,18 @@ this:
|
||||
cool: ay
|
||||
```
|
||||
|
||||
## Load from base64 encoded file
|
||||
Given a sample.yml file of:
|
||||
```yaml
|
||||
cool: things
|
||||
```
|
||||
then
|
||||
```bash
|
||||
yq '.more_stuff = load_base64("../../examples/base64.txt")' sample.yml
|
||||
```
|
||||
will output
|
||||
```yaml
|
||||
cool: things
|
||||
more_stuff: my secret chilli recipe is....
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user