檢視原始碼 STDLIB 應用程式

描述

STDLIB 應用程式是強制性的,因為基於 Erlang/OTP 的最小系統由 Kernel 和 STDLIB 組成。STDLIB 應用程式不包含任何服務。

組態

以下組態參數為 STDLIB 應用程式定義。關於組態參數的詳細資訊,請參閱 Kernel 中的 app(4) 模組。

  • shell_esc = icl | abort - 可用於變更按下 ^G 時 Erlang shell 的行為。

  • restricted_shell = module() - 可用於在受限模式下執行 Erlang shell。

  • shell_catch_exception = boolean() - 可用於設定 Erlang shell 的評估器程序之例外處理。

  • shell_expand_location = above | below - 設定 tab 展開文字在 shell 中的顯示位置。預設值為 below。這將在游標下方開啟一個分頁器,可使用 向上/向下箭頭鍵一次捲動一行,或使用 PgUp/PgDn 一次捲動 5 行。

  • shell_history_length = integer() >= 0 - 可用於決定 Erlang shell 儲存多少指令。更多資訊請參閱 edlin

  • shell_keymap = #{} - 可用於覆寫 shell 的預設鍵盤配置。

  • format_shell_func = {Mod, Func} | string() | default - 可用於設定 Erlang shell 輸出的格式。這會影響已提交的指令,以及如何在歷史紀錄中儲存,或是在編輯表達式時按下格式化熱鍵(預設為 Alt-f)。您可以指定一個 Mod:Func/1,它會將整個表達式作為字串,並傳回格式化的表達式作為字串。關於如何從 shell 內部設定,請參閱 shell:format_shell_func/1

    如果改為提供字串,它將被用作 shell 指令。您的指令必須在字串中的某處包含 ${file},以便 shell 知道檔案在指令中的位置。

    -stdlib format_shell_func "\"emacs -batch \${file} -l ~/erlang-format/emacs-format-file -f emacs-format-function\""
    -stdlib format_shell_func "{shell, erl_pp_format_func}"
  • shell_prompt_func = {Mod, Func} | default - 其中

    • Mod = atom()
    • Func = atom()

    可用於設定自訂的 Erlang shell 提示函數。

  • shell_multiline_prompt = {Mod, Func} | string() | default - 其中

    • Mod = atom()
    • Func = atom()

    可用於設定自訂的多行 shell 提示函數。多行提示函數將主提示作為其唯一參數。

  • shell_saved_results = integer() >= 0 - 可用於決定 Erlang shell 儲存多少結果。

  • shell_session_slogan = string() | fun() -> string()) - 啟動 Erlang shell 時印出的標語。範例

    $ erl -stdlib shell_session_slogan '"Test slogan"'
    Erlang/OTP 26 [DEVELOPMENT] [erts-13.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
    
    Test slogan
    1>
  • shell_slogan = string() | fun(() -> string()) - 啟動 Erlang shell 子系統時印出的標語。範例

    $ erl -stdlib shell_slogan '"Test slogan"'
    Test slogan
    Eshell V13.0.2  (abort with ^G)
    1>

    預設值為 erlang:system_info(system_version) 的傳回值。

  • shell_strings = boolean() - 可用於決定 Erlang shell 如何輸出整數列表。

另請參閱

app(4), application, shell