运行 shell 脚本作为混​​合别名

Running a shell script as a mix alias

你怎么能运行一个shell脚本作为混​​合别名?

我已经尝试了以下但没有成功:

defp aliases() do
  [
    "test": [ "./scripts/test.sh" ]
  ]
end

defp aliases() do
  [
    "test": [ "scripts/test.sh" ]
  ]
end

每个 returns 的变体为:

** (Mix) The task "./scripts/test" could not be found

您可以为此调用 Mix.Tasks.Cmd 任务:

"test": ["cmd ./scripts/test.sh"]
$ cat a.sh
#!/bin/bash
echo foo
$ cat mix.exs | grep test
      "test": ["cmd ./a.sh", "cmd echo bar"]
$ mix test
foo
bar