-
Notifications
You must be signed in to change notification settings - Fork 3.5k
mix help app:APP: Always try loading apps
#14894
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
base: main
Are you sure you want to change the base?
Conversation
Before this patch it was basically impossible to do e.g.: `mix help app:ex_unit`.
mix help app:APP: Always load all Elixir built-in appsmix help app:APP: Always try loading apps
lib/mix/lib/mix/tasks/help.ex
Outdated
| def run(["app:" <> app]) do | ||
| loadpaths!() | ||
| app = String.to_atom(app) | ||
| Application.ensure_loaded(app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we display:
$ mix help app:bad
Application bad does not exist or is not loaded
if we change it to Mix.ensure_application!(app), we'd see:
$ mix help app:bad
** (Mix) The application "bad" could not be found. This may happen if your Operating System broke Erlang into multiple packages and may be fixed by installing the missing "erlang-dev" and "erlang-bad" packages
I think former is fine but can see some rationale for latter. And then we could remove tiny bit of error handling code too while at it. Any preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid we need to use Mix.ensure_application!(app) in the case we prune code paths. So for example, what happens if you are inside a Mix project and you do mix help app:wx, does it still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, at the moment it does:
~/src/req[main]$ mix help app:wx
# :gl
Erlang wrapper functions for OpenGL
(...)
Happy to change to use Mix.ensure_application!(app) instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with ensure_application!, yeah, I think it will be more fool proof. Perhaps this will make it fail: mix do compile + help app:wx but I don't see why anyone would run that anyway...
Before this patch it was basically impossible to do e.g.:
mix help app:ex_unit.