fireproofsocks

fireproofsocks

Show help in custom mix task

I understand that the @moduledoc text is what gets shown when you type in mix help your.task:

Is there a way to show that information manually? For example, if my task has some required arguments or options, it’s possible to show an error using something like Mix.shell().error("Invalid input.), but I think it would be nicer in some cases to print out the usage info (just like you might encounter when you misuse a linux utility on the command line).

Thanks!

Marked As Solved

josevalim

josevalim

Creator of Elixir
Mix.Task.run("help", ["name.of.your.task"])

Also Liked

NobbZ

NobbZ

@moduledoc false and @doc false are conventions for internally used functions that need to be exposed because they are used through the project, but are also not part of the public interface of the library.

The reason why you can’t call the function, is because the source code you looked at does probably not match the elixir version you have installed.

This is the reason why the module is marked “internal”, this gives the core team the flexibility to change it as necessary without needing to think about backwards compatibility.

axelson

axelson

Scenic Core Team

Also do note that IO.ANSI.Docs is @moduledoc false which means it is an internal implementation detail of Elixir and you should not be calling it from your code.

https://github.com/elixir-lang/elixir/blob/da9b9014575c1930049235b0509657b2bde47319/lib/elixir/lib/io/ansi/docs.ex#L2

Last Post!

fireproofsocks

fireproofsocks

Yeah, I’m looking at the latest master branch of the Elixir source… that must be different than the 1.10.1 code that I am actually running…

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement