Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One liners > Pipe summary in jq (no file) #33

Closed
2 tasks done
adriens opened this issue Mar 16, 2022 · 12 comments
Closed
2 tasks done

One liners > Pipe summary in jq (no file) #33

adriens opened this issue Mar 16, 2022 · 12 comments
Assignees
Labels
enhancement New feature or request
Projects

Comments

@adriens
Copy link
Member

adriens commented Mar 16, 2022

Context

Some of uf like one liners as they are cool and fun to use... and help promote nice looking shell scripts

Actions

  • Please create a one liner that send putput direclty in jq
  • Any other oneliners
@adriens adriens added the enhancement New feature or request label Mar 16, 2022
@adriens adriens added this to Candidates in yamlfixer via automation Mar 16, 2022
@adriens
Copy link
Member Author

adriens commented Mar 16, 2022

Do you find this cool @tamere-allo-peter ?

@tamere-allo-peter
Copy link
Member

tamere-allo-peter commented Mar 16, 2022

jerome@OPT17844:~/yamlfixer$ yamlfixer --jsonsummary bad.yml 2>&1 | jq 
{
  "filestofix": 1,
  "passedstrictmode": 1,
  "modified": 0,
  "skipped": 0,
  "notwriteable": 0,
  "unknown": 0,
  "details": {
    "/home/jerome/yamlfixer/bad.yml": {
      "status": "PASSED",
      "issues": 0,
      "handled": 0
    }
  }
}
jerome@OPT17844:~/yamlfixer$ 

@tamere-allo-peter
Copy link
Member

tamere-allo-peter commented Mar 16, 2022

@adriens Another way using only pipes (I had forgotten) :

yamlfixer --jsonsummary <bad.yml 2>&1 >/dev/null | jq

This way the fixed YAML code is sent to /dev/null but the JSON output is sent to stdout.

Beware : if you invert the stderr and stdout redirections this won't do what you want. Order does matter !

@adriens
Copy link
Member Author

adriens commented Mar 16, 2022

I love piping commands, I must confess @tamere-allo-peter

adriens added a commit that referenced this issue Mar 16, 2022
@adriens
Copy link
Member Author

adriens commented Mar 16, 2022

@tamere-allo-peter , here it is included into the documentation cf #37

@adriens
Copy link
Member Author

adriens commented Mar 16, 2022

ANy other oneLiner idea ❔

@adriens
Copy link
Member Author

adriens commented Mar 16, 2022

If not, i'll close the issue, maybe @mbarre could have some ? We could also wait for incoming questions ✔️

@adriens adriens moved this from Candidates to In progress in yamlfixer Mar 16, 2022
@tamere-allo-peter
Copy link
Member

jerome@OPT17844:~/yamlfixer$ yamlfixer <bad.yml | yamllint --format parsable --strict -
jerome@OPT17844:~/yamlfixer$ echo $?
0
jerome@OPT17844:~/yamlfixer$ 

@adriens
Copy link
Member Author

adriens commented Mar 16, 2022

I'm adding it to the doc section ⚡

adriens added a commit that referenced this issue Mar 16, 2022
@adriens
Copy link
Member Author

adriens commented Mar 16, 2022

Added, just merge #37

@tamere-allo-peter
Copy link
Member

@adriens : shouldn't we close this one ?

@adriens
Copy link
Member Author

adriens commented Mar 17, 2022

Sure, I'm going to make a dedicated issue for code sample requests 👍

@adriens adriens closed this as completed Mar 17, 2022
yamlfixer automation moved this from In progress to Done Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants