当我在mix.exsand run 中定义别名时mix help,它只会将其描述显示为“在 mix.exs 中定义的别名”。
假设,例如,我有这个mix.exs:
defp aliases do
[
play: "run --no-halt"
]
end
Run Code Online (Sandbox Code Playgroud)
然后,该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
...
Run Code Online (Sandbox Code Playgroud)
如何描述play任务?
的输出来自自定义混合任务中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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
我认为没有办法为别名添加帮助文档。
| 归档时间: |
|
| 查看次数: |
119 次 |
| 最近记录: |