繁体   English   中英

如何对 mix.exs 中定义的别名进行描述?

[英]How to give a description to an alias defined in mix.exs?

当我在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属性

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

我认为没有办法为别名添加帮助文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM