Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print help args if running rubyfmt with no args in tty #376

Merged
merged 1 commit into from
Nov 28, 2022

Conversation

reese
Copy link
Collaborator

@reese reese commented Nov 26, 2022

Resolves #373

rubyfmt with no args generally reads from stdin, but some users will just run it on its own. There are several things we could do here, like just exit early, return what would be formatted by passing "", or something else, but I think printing the equivalent of rubyfmt --help is the most user-friendly (although I'm open to an alternative, since many unix tools will just return "" or something like that).

I tried adding a test for this, but I'm terrible with bash and faking tty in our bash tests was getting to be more effort than it's worth, so I opted to just stick with manual testing with cargo run and making sure that echo "class Foo; end" | cargo run still works as expected.

@reese reese merged commit b15f917 into trunk Nov 28, 2022
@reese reese deleted the reese-no-args-tty branch November 28, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running rubyfmt with no args hangs
2 participants