sorawee / fmt

A code formatter for Racket
Other
72 stars 6 forks source link

Format stdin->stdout #19

Closed lassik closed 2 years ago

lassik commented 2 years ago

The following command line currently works:

echo '#lang racket' | raco fmt /dev/stdin

Can you make either raco fmt (with no filename) or raco fmt --stdin format from stdin to stdout? This would avoid the Linux/BSD-specific /dev/stdin.

lassik commented 2 years ago

(For context, stdin->stdout is the best way for text editor plugins to call formatters.)

sorawee commented 2 years ago

Thanks for the report!

APIPLM commented 2 years ago

As running echo '#lang racket' | raco fmt --stdin with the latest source code. The following error: raco: unknown switch: --stdin

sorawee commented 2 years ago

Oh, I took the @lassik's first suggestion where you don't provide any filename to enter the stdin mode. So that error is expected.

APIPLM commented 2 years ago

You mean echo '#lang racket' | raco fmt?

sorawee commented 2 years ago

Correct.

lassik commented 2 years ago

raco fmt is now supported by the Emacs format-all package.

sorawee commented 2 years ago

Thanks! :)