Skip to content

Commit

Permalink
Add indent level support for yq JSON, XML, and YAML (radian-software#259
Browse files Browse the repository at this point in the history
)

Co-authored-by: Radon Rosborough <[email protected]>
  • Loading branch information
scop and raxod502 authored Dec 15, 2023
1 parent 022cf17 commit 3aa7478
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
9 changes: 6 additions & 3 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3aa7478

Please sign in to comment.