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

时间:2018-04-03 16:14:59

标签: elixir mix

如何将shell脚本作为混​​合别名运行?

我试过以下但没有运气:

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

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

每个返回的变体为:

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

1 个答案:

答案 0 :(得分:2)

您可以使用调用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