tconbeer / sqlfmt

sqlfmt formats your dbt SQL files so you don't have to
https://sqlfmt.com
Apache License 2.0
373 stars 15 forks source link

Support formatting stdin? #555

Closed mxr closed 6 months ago

mxr commented 6 months ago

Hello, would you consider accepting a PR to support formatting SQL from stdin? This would let me format SQL that I write adhoc (in Mode, Snowflake, etc) without needing to save a file to disk. It's also a common standard for code formatters to support formatting both files and stdin. Thanks for the great tool!

tconbeer commented 6 months ago

we already support this! sqlfmt - and then paste (and then ctrl+d), or cat myfile.sql | sqlfmt -

mxr commented 6 months ago

Oops, you're right, just saw this in the docs too

  The FILES argument can be one or many paths to sql files (or directories),
  or use "-" to use stdin.