[英]How to give a description to an alias defined in mix.exs?
When I define an alias in the mix.exs
and run mix help
, it just shows its description as "Alias defined in mix.exs".当我在mix.exs
定义别名并运行mix help
,它只会将其描述显示为“在 mix.exs 中定义的别名”。
Suppose, for example, I have this mix.exs
:例如,假设我有这个mix.exs
:
defp aliases do
[
play: "run --no-halt"
]
end
Then, the mix help
command displays task list like this:然后, mix help
命令显示如下任务列表:
...
mix local.rebar # Installs Rebar locally
mix new # Creates a new Elixir project
mix play # Alias defined in mix.exs
mix profile.cprof # Profiles the given file or expression with cprof
mix profile.eprof # Profiles the given file or expression with eprof
...
How can I give a description to the play
task?如何描述play
任务?
The output from mix help
comes from the @shortdoc
attribute in a custom mix task mix help
的输出来自自定义混合任务中的@shortdoc
属性
defmodule Mix.Tasks.Play do
use Mix.Task
@shortdoc "run with --no-halt"
@impl Mix.Task
def run(_) do
Mix.Task.run("run", ["--no-halt"])
end
end
mix help | grep "mix play"
mix play # run with --no-halt
I don't think there is a way to add help docs for aliases.我认为没有办法为别名添加帮助文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.