fables-tales/rubyfmt

Argument not expected

Closed this issue · 4 comments

  • Ruby version: 3.0.1
  • Rubyfmt git sha: rubyfmt-main 0.8.0-pre

Command

file app/models/user.rb
=> app/models/user.rb: Ruby script text, ASCII text

rubyfmt -i app/models/user.rb

Rubyfmt's output

error: Found argument 'app/models/user.rb' which wasn't expected, or isn't valid in this context

USAGE:
    rubyfmt [OPTIONS] [-- <include-paths>...]

For more information try --help

This breaks because

I don't know, I installed it with brew install rubyfmt, I am currently on arch arm64.

reese commented

While I think we should eventually get rid of the requirement for the --, it's currently necessary, and the README gives examples of passing files:

rubyfmt -i -- app/models/user.rb
reese commented

Going to close this out since it's documented both in the help text and the README, and there are thoughts on potentially changing this anyways, but if you have any other questions feel free to reopen or add more comments!

I am sorry, it didn't click for me when I saw rubyfmt -i -- files or directories on README, should we add an example like rubyfmt -i -- my_file.rb next to it to make it clearer?

Thank you so much for your work, it's nice to see the Ruby community having its own formatter 👍🏻

reese commented

The current version (0.8.1) actually now supports both! I do want to reformat the README more broadly though, because there's now quite a few more flags than there were when the README was originally written, so I think it's worth revisiting that whole section at some point.