Skip to content

Conversation

@wojtekmach
Copy link
Member

Prior to this patch, it was impossible to get help for the current app:

nimble_csv$ mix help app:nimble_csv
Application nimble_csv does not exist or is not loaded

It also helps with projects with depenendencies when they haven't been
compiled yet:

req$ mix deps.get && mix help app:finch # mix deps.compile haven't been run yet
Application finch does not exist or is not loaded

Now it works:

nimble_csv$ mix help app:nimble_csv
Compiling 1 file (.ex)
Generated nimble_csv app
# NimbleCSV

NimbleCSV is a small and fast parsing and dumping library.

# NimbleCSV.RFC4180

A CSV parser that uses comma as separator and double-quotes as escape according
to RFC4180.

# NimbleCSV.Spreadsheet

A parser with spreadsheet friendly settings.

The task continues to work as expected outside of a Mix project:

/tmp$ mix help app:nimble_csv
Application nimble_csv does not exist or is not loaded

/tmp$ mix help app:public_key
# :public_key

API module for public-key infrastructure.

@wojtekmach wojtekmach changed the title mix help app:APP: Load current Mix project mix help app:APP: Compile current Mix project Nov 25, 2025
@wojtekmach wojtekmach changed the title mix help app:APP: Compile current Mix project mix help app:APP: Compile current Mix project (if any) Nov 25, 2025

if Mix.Project.get() do
Mix.Task.run("compile")
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then if the project doesn't compile, we can't get help. I would do this:

if app != "" and Atom.to_string(Mix.Project.config[:app]) == app do
  Mix.Task.run("compile")
end

Also, we can probably add a test for this feature.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would not solve:

It also helps with projects with depenendencies when they haven't been
compiled yet:

req$ mix deps.get && mix help app:finch # mix deps.compile haven't been run yet
Application finch does not exist or is not loaded

but dunno how big of a deal it is in practice, I suppose we can always guide users towards that with error messages or something. So yeah, I will move forward with this, thank you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wojtekmach what if we change the rescue branch of Mix.ensure_application! to call Mix.Task.run("compile")? So we compile only when we cannot find the app?

Comment on lines 131 to 132

Mix.ensure_application!(app)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Mix.ensure_application!(app)

wojtekmach and others added 10 commits November 27, 2025 15:03
Prior to this patch, it was impossible to get help for the current app:

    nimble_csv$ mix help app:nimble_csv
    Application nimble_csv does not exist or is not loaded

It also helps with projects with depenendencies when they haven't been
compiled yet:

    req$ mix deps.get && mix help app:finch # mix deps.compile haven't been run yet
    Application finch does not exist or is not loaded

Now it works:

    nimble_csv$ mix help app:nimble_csv
    Compiling 1 file (.ex)
    Generated nimble_csv app
    # NimbleCSV

    NimbleCSV is a small and fast parsing and dumping library.

    # NimbleCSV.RFC4180

    A CSV parser that uses comma as separator and double-quotes as escape according
    to RFC4180.

    # NimbleCSV.Spreadsheet

    A parser with spreadsheet friendly settings.

The task continues to work as expected outside of a Mix project:

    /tmp$ mix help app:nimble_csv
    Application nimble_csv does not exist or is not loaded

    /tmp$ mix help app:public_key
    # :public_key

    API module for public-key infrastructure.
@josevalim josevalim merged commit 75c5aa0 into elixir-lang:main Nov 27, 2025
13 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

josevalim pushed a commit that referenced this pull request Nov 27, 2025
Prior to this patch, it was impossible to get help for the current app:

    nimble_csv$ mix help app:nimble_csv
    Application nimble_csv does not exist or is not loaded

It also helps with projects with depenendencies when they haven't been
compiled yet:

    req$ mix deps.get && mix help app:finch # mix deps.compile haven't been run yet
    Application finch does not exist or is not loaded

Now it works:

    nimble_csv$ mix help app:nimble_csv
    Compiling 1 file (.ex)
    Generated nimble_csv app
    # NimbleCSV

    NimbleCSV is a small and fast parsing and dumping library.

    # NimbleCSV.RFC4180

    A CSV parser that uses comma as separator and double-quotes as escape according
    to RFC4180.

    # NimbleCSV.Spreadsheet

    A parser with spreadsheet friendly settings.
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