问题描述
当我在mix.exs
中定义一个别名并运行mix help
时,它只是将其描述显示为“在mix.exs中定义的别名”。
例如,假设我有这个mix.exs
:
defp aliases do
[
play: "run --no-halt"
]
end
然后,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
...
如何描述play
任务?
解决方法
mix help
的输出来自@shortdoc
attribute的自定义混合任务
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
我认为没有办法为别名添加帮助文档。