跳转到内容

mise env ​

  • 用法: mise env [FLAGS] [TOOL@VERSION]…
  • 别名: e
  • 效果: 只读
  • 源代码: src/cli/env.rs

打印当前配置的环境

计算 Shell 输出以加载工具和变量一次,而无需安装提示钩子。之后更改目录不会重新计算此环境。 使用 mise exec -- command 可将其应用于一个子进程。

JSON, dotenv, and shell output contain actual variable values, including secrets. --redacted selects variables marked for redaction; it does not mask their values. Tools you pass as TOOL@VERSION arguments are installed first if they are missing; missing tools from the config are reported, not installed.

Arguments ​

  • [TOOL@VERSION]… — Tools to include in addition to those in the config, such as node@24

标志 ​

  • -D --dotenv — 以 dotenv 格式输出

  • -J --json — 以 JSON 格式输出

  • -s --shell <SHELL> — 为其生成环境变量的 Shell 类型

    选项: bash、elvish、fish、nu、xonsh、zsh、pwsh、powershell

  • --json-extended — 以 JSON 格式输出其他信息(来源、工具)

  • --redacted — 仅包含标记为要隐藏的变量;其值会以未屏蔽的形式打印

  • --values — 仅显示环境变量的值

  • --paths — 按 PATH 顺序逐行打印 mise 管理的 PATH 条目

  • -h --help — 打印帮助

示例 ​

Load the environment once into the current bash session

eval "$(mise env -s bash)"

Same, for zsh

eval "$(mise env -s zsh)"

Same, for fish

mise env -s fish | source

Same, for xonsh

execx($(mise env -s xonsh))

Print the variables as JSON

mise env --json

列出 mise 管理的 PATH 条目,例如工具的 bin 目录

mise env --paths

Write a dotenv file; it contains secret values

mise env --dotenv > .env

相关文档 ​