-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Did you mean flag #6316
Did you mean flag #6316
Conversation
…on did you mean crystal foo.cr -- --flag' from PR crystal-lang#5291
Sorry, but this change makes no sense. What problem are you trying to solve? |
@asterite #5291 |
That issue is about showing suggestions for when you pass a flag to the compiler, and the flag is not found. Here you are changing option parser (which can be used in any crystal program, not just the compiler), to suggest that the flag should be passed Ina different way. And that makes no sense at all. |
@benglewis |
Oh. |
@benglewis I've run into this myself, especially when I was just starting Crystal. I would have loved to have seen a nice error like the one you are suggesting so I wouldn't have to ask for help. @straight-shoota or @asterite could you provide a link to the file or some other guidance so that this suggestion could be shown in the correct place? That may help @benglewis or someone else make the changes to add this feature in the right place |
This is the place to look: https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/command.cr#L170 |
The original proposal is that if you run a program with And I wouldn't go down the route of adding a flag that is present if you run the program through crystal, just for this error message. There should simply be an answer to this in stackoverflow.com, problem solved. https://stackoverflow.com/questions/45117892/passing-cli-arguments-to-excutables-with-go-run |
I didn't read the original issue so that was my mistake. I don't think it is a high priority, but I do think that Crystal will be more loved if more helpful errors can be shown to users. It's such a delight when languages/libraries give me a hint that saves even just a few minutes. So maybe it would be hard, but if someone adds it, I think it would be a great addition! Especially because people may not know what to google for. My thought would be that it only applies when using the What do you think? If someone does implement it, would it be worth adding to save time and give users that extra bit of help so they don't break their flow? |
As usual, if someone wants to implement it, go ahead. After all I'm no longer approving/merging PRs :-P |
Also note that if you have a program that just does So I don't think the original issue makes much sense. That's just my opinion, though, but again, this seems impossible to implement. |
Really, Options before the filename should go the compiler, options after should go to the file. As well as being less confusing, this also makes it possible to do |
Thank you for the discussion guys. I am in agreement with @RX14 here. I think that simply considering the order of the flags would be the most logical version to me as a user, but I do understand that that may not fit with the strategy for Crystal. If a conclusion can be reached on what to implement, I would be happy to try as a complete newbie to Crystal :) |
I can't seem to build the tests 100% on my Mac, so I'm opening this unable to 100% verify it :(