Skip to content

Commit

Permalink
Merge pull request #37 from opt-nc/one-liners-piping-to-jq
Browse files Browse the repository at this point in the history
🚀 One liners : pipe into jq
  • Loading branch information
tamere-allo-peter authored Mar 17, 2022
2 parents b221595 + c76f0a7 commit 4fa85f1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,46 @@ circumstances.
⚠️**Use at your own risk, you have been warned...** ⚠️
# 💪 Tips and tips
## ⏩ One liners
Most of use love short and efficient command lines. Here are some ready to use ones :
### Piping `json` summary through `jq`
```
yamlfixer --jsonsummary bad.yml 2>&1 | jq
```
So you can get a nicely colored (and vlidated `json` output) :
```json
"filestofix": 1,
"passedstrictmode": 1,
"modified": 0,
"skipped": 0,
"notwriteable": 0,
"unknown": 0,
"details": {
"/home/jerome/yamlfixer/bad.yml": {
"status": "PASSED",
"issues": 0,
"handled": 0
}
}
}
```
### Check if `yamlfixer` could fix a `yaml` and get the exit code
See how piping fixing and linting can be intersting... and get exit code
so you can go furher in automation :
```
yamlfixer <bad.yml | yamllint --format parsable --strict -
echo $?
```
# 🔖 Related contents
Expand Down

0 comments on commit 4fa85f1

Please sign in to comment.