Add support for yq (#250)

<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
This commit is contained in:
Ville Skyttä 2023-11-23 22:19:04 +02:00 committed by GitHub
parent 615b0f5591
commit 2b354f405b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 60 additions and 1 deletions

View file

@ -64,6 +64,7 @@ The format is based on [Keep a Changelog].
### Formatters ### Formatters
* [`yq`](https://mikefarah.gitbook.io/yq/) for YAML, JSON, CSV, TSV, XML and [.properties](https://en.wikipedia.org/wiki/.properties) ([#250]).
* [purs-tidy](https://github.com/natefaubion/purescript-tidy) for PureScript ([#182]). * [purs-tidy](https://github.com/natefaubion/purescript-tidy) for PureScript ([#182]).
* [`jq`](https://stedolan.github.io/jq/) for * [`jq`](https://stedolan.github.io/jq/) for
[JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON) [JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON)

View file

@ -149,7 +149,19 @@
(stylua . ("stylua" "-")) (stylua . ("stylua" "-"))
(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout")) (rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
(terraform . ("terraform" "fmt" "-")) (terraform . ("terraform" "fmt" "-"))
(yapf . ("yapf"))) (yapf . ("yapf"))
(yq-csv . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "csv" "--output-format" "csv"))
(yq-json . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "json" "--output-format" "json"))
(yq-properties . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "props" "--output-format" "props"))
(yq-tsv . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "tsv" "--output-format" "tsv"))
(yq-xml . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "xml" "--output-format" "xml"))
(yq-yaml . ("yq" "--prettyPrint" "--no-colors" "--no-doc"
"--input-format" "yaml" "--output-format" "yaml")))
"Alist of code formatting commands. "Alist of code formatting commands.
The keys may be any symbols you want, and the values are shell The keys may be any symbols you want, and the values are shell
commands, lists of strings and symbols, or a function symbol. commands, lists of strings and symbols, or a function symbol.

View file

@ -0,0 +1 @@
yq-yaml.bash

View file

@ -0,0 +1 @@
yq-yaml.bash

View file

@ -0,0 +1 @@
yq-yaml.bash

View file

@ -0,0 +1 @@
yq-yaml.bash

View file

@ -0,0 +1 @@
yq-yaml.bash

View file

@ -0,0 +1 @@
curl -fsSLo /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && chmod +x /usr/local/bin/yq

View file

@ -0,0 +1,2 @@
hello,"world"
a,"1,2"
1 hello world
2 a 1,2

View file

@ -0,0 +1,2 @@
hello,world
a,"1,2"
1 hello world
2 a 1,2

View file

@ -0,0 +1 @@
../prettier-json/in.json

View file

@ -0,0 +1,19 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}

View file

@ -0,0 +1 @@
foo=bar

View file

@ -0,0 +1 @@
foo = bar

View file

@ -0,0 +1,2 @@
hello "world"
a "1 2"
1 hello world
2 a 1 2

View file

@ -0,0 +1,2 @@
hello world
a "1 2"
1 hello world
2 a 1 2

View file

@ -0,0 +1 @@
<hello who='world' />

View file

@ -0,0 +1 @@
<hello who="world"></hello>

View file

@ -0,0 +1 @@
../prettier-yaml/in.yml

View file

@ -0,0 +1,7 @@
- hosts: all
tasks:
- name: Get software for apt repository management.
apt:
state: present
name:
- python3-pycurl