tconbeer/sqlfmt

Support formatting stdin?

Closed this issue · 2 comments

mxr commented

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!

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

mxr commented

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.