簡體   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