Skip to content

Commit

Permalink
feat: add beautysh, taplo, trim_newlines and trim_whitespace (#29)
Browse files Browse the repository at this point in the history
* feat: add beautysh

* feat: add taplo

* feat: add trim_newlines

* feat: add trim_whitespace

* doc: mention that `trim_newlines` and `trim_whitespaces` are using `awk`

---------

Co-authored-by: xfzv <>
  • Loading branch information
xfzv authored Sep 7, 2023
1 parent 076ac4d commit 37a2d65
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ To view configured and available formatters, as well as to see the path to the l

- [autoflake](https://github.com/PyCQA/autoflake) - Removes unused imports and unused variables as reported by pyflakes.
- [autopep8](https://github.com/hhatto/autopep8) - A tool that automatically formats Python code to conform to the PEP 8 style guide.
- [beautysh](https://github.com/lovesegfault/beautysh) - A Bash beautifier for the masses.
- [black](https://github.com/psf/black) - The uncompromising Python code formatter.
- [clang_format](https://www.kernel.org/doc/html/latest/process/clang-format.html) - Tool to format C/C++/… code according to a set of rules and heuristics.
- [cljstyle](https://github.com/greglook/cljstyle) - Formatter for Clojure code.
Expand Down Expand Up @@ -189,7 +190,10 @@ To view configured and available formatters, as well as to see the path to the l
- [stylua](https://github.com/JohnnyMorganz/StyLua) - An opinionated code formatter for Lua.
- [swift_format](https://github.com/apple/swift-format) - Swift formatter from apple. Requires building from source with `swift build`.
- [swiftformat](https://github.com/nicklockwood/SwiftFormat) - SwiftFormat is a code library and command-line tool for reformatting `swift` code on macOS or Linux.
- [taplo](https://github.com/tamasfe/taplo) - A TOML toolkit written in Rust
- [terraform_fmt](https://www.terraform.io/docs/cli/commands/fmt.html) - The terraform-fmt command rewrites `terraform` configuration files to a canonical format and style.
- [trim_newlines](https://www.gnu.org/software/gawk/manual/gawk.html) - Trim new lines with `awk`
- [trim_whitespace](https://www.gnu.org/software/gawk/manual/gawk.html) - Trim whitespaces with `awk`
- [uncrustify](https://github.com/uncrustify/uncrustify) - A source code beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and Vala.
- [xmlformat](https://github.com/pamoller/xmlformatter) - xmlformatter is an Open Source Python package, which provides formatting of XML documents.
- [yamlfix](https://github.com/lyz-code/yamlfix) - A configurable YAML formatter that keeps comments.
Expand Down
9 changes: 9 additions & 0 deletions lua/conform/formatters/beautysh.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/lovesegfault/beautysh",
description = "A Bash beautifier for the masses.",
},
command = "beautysh",
args = { "-" }
}
9 changes: 9 additions & 0 deletions lua/conform/formatters/taplo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/tamasfe/taplo",
description = "A TOML toolkit written in Rust",
},
command = "taplo",
args = { "format", "-" },
}
9 changes: 9 additions & 0 deletions lua/conform/formatters/trim_newlines.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://www.gnu.org/software/gawk/manual/gawk.html",
description = "Trim new lines with awk",
},
command = "awk",
args = { 'NF{print s $0; s=""; next} {s=s ORS}' },
}
9 changes: 9 additions & 0 deletions lua/conform/formatters/trim_whitespace.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://www.gnu.org/software/gawk/manual/gawk.html",
description = "Trim whitespaces with awk",
},
command = "awk",
args = { '{ sub(/[ \t]+$/, ""); print }' },
}

0 comments on commit 37a2d65

Please sign in to comment.