Add indent level support for yq JSON, XML, and YAML (#259)

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
This commit is contained in:
Ville Skyttä 2023-12-15 04:53:39 +02:00 committed by GitHub
parent 022cf17464
commit 3aa747856a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -10,6 +10,7 @@ The format is based on [Keep a Changelog].
settings ([#261]). settings ([#261]).
* Indent level is now determined for `graphql-mode`, `html-mode`, `ruby-mode`, * Indent level is now determined for `graphql-mode`, `html-mode`, `ruby-mode`,
`ruby-ts-mode`, `svelte-mode`, and `yaml-mode` ([#258]). `ruby-ts-mode`, `svelte-mode`, and `yaml-mode` ([#258]).
* Indent level support when using yq to format JSON, XML, and YAML ([#259]).
### Formatters ### Formatters
* [`dprint`](https://dprint.dev) for various (depending on * [`dprint`](https://dprint.dev) for various (depending on
@ -34,6 +35,7 @@ The format is based on [Keep a Changelog].
[#229]: https://github.com/radian-software/apheleia/pull/229 [#229]: https://github.com/radian-software/apheleia/pull/229
[#257]: https://github.com/radian-software/apheleia/pull/257 [#257]: https://github.com/radian-software/apheleia/pull/257
[#258]: https://github.com/radian-software/apheleia/pull/258 [#258]: https://github.com/radian-software/apheleia/pull/258
[#259]: https://github.com/radian-software/apheleia/pull/259
[#260]: https://github.com/radian-software/apheleia/pull/260 [#260]: https://github.com/radian-software/apheleia/pull/260
[#261]: https://github.com/radian-software/apheleia/pull/261 [#261]: https://github.com/radian-software/apheleia/pull/261
[#263]: https://github.com/radian-software/apheleia/pull/263 [#263]: https://github.com/radian-software/apheleia/pull/263

View file

@ -187,15 +187,18 @@
(yq-csv . ("yq" "--prettyPrint" "--no-colors" (yq-csv . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "csv" "--output-format" "csv")) "--input-format" "csv" "--output-format" "csv"))
(yq-json . ("yq" "--prettyPrint" "--no-colors" (yq-json . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "json" "--output-format" "json")) "--input-format" "json" "--output-format" "json"
(apheleia-formatters-indent nil "--indent")))
(yq-properties . ("yq" "--prettyPrint" "--no-colors" (yq-properties . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "props" "--output-format" "props")) "--input-format" "props" "--output-format" "props"))
(yq-tsv . ("yq" "--prettyPrint" "--no-colors" (yq-tsv . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "tsv" "--output-format" "tsv")) "--input-format" "tsv" "--output-format" "tsv"))
(yq-xml . ("yq" "--prettyPrint" "--no-colors" (yq-xml . ("yq" "--prettyPrint" "--no-colors"
"--input-format" "xml" "--output-format" "xml")) "--input-format" "xml" "--output-format" "xml"
(apheleia-formatters-indent nil "--indent")))
(yq-yaml . ("yq" "--prettyPrint" "--no-colors" "--no-doc" (yq-yaml . ("yq" "--prettyPrint" "--no-colors" "--no-doc"
"--input-format" "yaml" "--output-format" "yaml"))) "--input-format" "yaml" "--output-format" "yaml"
(apheleia-formatters-indent nil "--indent"))))
"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.