google / yamlfmt

An extensible command line tool or library to format yaml files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Request] Change `-in` to `-`

Suavesito-Olimpiada opened this issue · comments

First of, thanks for the amazing tool! :D

In many CLI programs is usual that stdin is configured automatically for input if no arguments were added. But, in many others (were no arguments means print help) it is (almost) standard to have - mean read from stdin.

I know is not important, but I propose follow the semantics of others, as I think allow for a (a little bit) more seamless experience. :)

Thank you for the suggestion! It didn't occur to me during development to do this, but it definitely makes sense. I'll target it for v0.3.0.

@Suavesito-Olimpiada I opened a PR for this change. Please let me know if this matches what you had in mind!
I had to do it a bit weirdly to keep consistent behaviour on Windows, since I assume - wouldn't be an alias to /dev/stdin on that.

Yeah, that looks exactly like it. I understand why you make it that way, /dev/stdin does not exist properly on Windows and currently yamlfmt will not output anything if passed /dev/stdin on Linux (although it "works" in the sense that it does not crash).