Stream: ideas

Topic: Consolidate `roc format --stdin --stdout`


view this post on Zulip Isaac Van Doren (Mar 09 2025 at 23:16):

Right now we have --stdin and --stdout for roc format:

$ roc format --help
...
      --stdin    Read file to format from stdin
      --stdout   Print formatted file to stdout

I propose we merge these into a single flag called --stdin that reads from stdin and writes to stdout. I suspect this is what people would want most of the time. This is also what Zig does:

$ zig fmt --help
...
--stdin                Format code from stdin; output to stdout

If you need more control you can always still pipe things:

cat input.roc | roc format --stdin
roc format --stdin > output.roc

This is a way that we can slightly decrease the surface area of the CLI which always seems nice to me :smile:

view this post on Zulip Brendan Hansknecht (Mar 09 2025 at 23:26):

What does stdin without stdout even do?

view this post on Zulip Brendan Hansknecht (Mar 09 2025 at 23:26):

And yeah, sounds good to merge

view this post on Zulip Isaac Van Doren (Mar 10 2025 at 00:08):

roc format foo.roc --stdout prints the formatted version of foo.roc to stdout. It looks like roc format --stdout is a noop (I haven't actually looked at the code). I'm not sure if there's anythign reasonable for it to do


Last updated: Jun 16 2026 at 16:19 UTC