diff --git a/CHANGELOG.md b/CHANGELOG.md index 59d589b..b21c16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog]. settings ([#261]). * Indent level is now determined for `graphql-mode`, `html-mode`, `ruby-mode`, `ruby-ts-mode`, `svelte-mode`, and `yaml-mode` ([#258]). +* Indent level support when using yq to format JSON, XML, and YAML ([#259]). ### Formatters * [`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 [#257]: https://github.com/radian-software/apheleia/pull/257 [#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 [#261]: https://github.com/radian-software/apheleia/pull/261 [#263]: https://github.com/radian-software/apheleia/pull/263 diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 42fa485..abdb009 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -187,15 +187,18 @@ (yq-csv . ("yq" "--prettyPrint" "--no-colors" "--input-format" "csv" "--output-format" "csv")) (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" "--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")) + "--input-format" "xml" "--output-format" "xml" + (apheleia-formatters-indent nil "--indent"))) (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. The keys may be any symbols you want, and the values are shell commands, lists of strings and symbols, or a function symbol.