Skip to content

Conversation

@wojtekmach
Copy link
Member

Before this patch it was basically impossible to do e.g.: mix help app:ex_unit.

Before this patch it was basically impossible to do e.g.: `mix help app:ex_unit`.
@wojtekmach wojtekmach changed the title mix help app:APP: Always load all Elixir built-in apps mix help app:APP: Always try loading apps Nov 5, 2025
def run(["app:" <> app]) do
loadpaths!()
app = String.to_atom(app)
Application.ensure_loaded(app)
Copy link
Member Author

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?

Copy link
Member

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?

Copy link
Member Author

@wojtekmach wojtekmach Nov 5, 2025

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.

Copy link
Member

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants