檢視原始碼 mix escript.install (Mix v1.16.2)

在本地安裝 escript。

如果沒有提供參數,但專案根目錄中有一個 escript(使用 mix escript.build 建立),則 escript 將會在本地安裝。例如

$ mix do escript.build + escript.install

如果提供參數,它應該是一個預先建置 escript 的本地路徑、Git 存放庫、GitHub 存放庫或 Hex 套件。

$ mix escript.install escript
$ mix escript.install path/to/escript
$ mix escript.install git https://path/to/git/repo
$ mix escript.install git https://path/to/git/repo branch git_branch
$ mix escript.install git https://path/to/git/repo tag git_tag
$ mix escript.install git https://path/to/git/repo ref git_ref
$ mix escript.install github user/project
$ mix escript.install github user/project branch git_branch
$ mix escript.install github user/project tag git_tag
$ mix escript.install github user/project ref git_ref
$ mix escript.install hex hex_package
$ mix escript.install hex hex_package 1.2.3

安裝後,escript 可以這樣呼叫

$ ~/.mix/escripts/foo

為方便起見,請考慮將 ~/.mix/escripts 目錄新增到您的 $PATH 環境變數。更多資訊,請查看 PATH 的維基百科條目:https://en.wikipedia.org/wiki/PATH_(variable)

命令列選項

  • --sha512 - 檢查 escript 是否與指定的 SHA-512 校驗和相符。僅適用於透過本地路徑安裝

  • --force - 強制安裝而不顯示 shell 提示;主要用於自動化建置系統(例如 Make)

  • --submodules - 從 Git 或 GitHub 建置 escript 前,擷取存放庫子模組

  • --sparse - 從 Git 存放庫中簽出一個目錄,並將其用作 escript 專案目錄

  • --app - 指定自訂應用程式名稱,用於從 Git、GitHub 或 Hex 建置 escript

  • --organization - 設定此項以使用屬於組織的 Hex 私有套件

  • --repo - 設定此項以使用自架設的 Hex 執行個體,預設為 hexpm