Skip to content

Commit

Permalink
Add support for sqlfmt for dbt
Browse files Browse the repository at this point in the history
  • Loading branch information
yatsky committed Mar 24, 2024
1 parent 6031df7 commit 87ed832
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sqlformat.el
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
This command should receive SQL input via STDIN and output the
reformatted SQL to STDOUT, returning an appropriate exit code."
:type '(choice (const :tag "Use \"sqlformat\"" sqlformat)
(const :tag "Use \"sqlfmt\"" sqlfmt)
(const :tag "Use \"pgformatter\"" pgformatter)
(const :tag "Use \"sqlfluff\"" sqlfluff)
(const :tag "Use \"sql-formatter\"" sql-formatter)))
Expand All @@ -88,11 +89,13 @@ For example, these args may be useful for sqlformat: (\"-k\" \"upper\")"
(reformatter-define sqlformat
:program (pcase sqlformat-command
(`sqlformat "sqlformat")
(`sqlfmt "sqlfmt")
(`pgformatter "pg_format")
(`sqlfluff "sqlfluff")
(`sql-formatter "sql-formatter"))
:args (pcase sqlformat-command
(`sqlformat (append sqlformat-args '("-r" "-")))
(`sqlfmt (append sqlformat-args '("-")))
(`pgformatter (append sqlformat-args '("-")))
(`sqlfluff (append '("format") sqlformat-args '("-")))
(`sql-formatter sqlformat-args))
Expand Down

0 comments on commit 87ed832

Please # to comment.