jdx/mise

`mise sh [TOOL@VERSION]` prints the export without executing it

zachallaun opened this issue · 0 comments

Describe the bug
mise sh is documented as an alias for mise shell, but its behavior differs, outputting export MISE_[TOOL]_VERSION=[VERSION] but not actually setting the variable.

To Reproduce

$ mise current elixir
1.15.8-otp-25

$ mise sh elixir@1.17.2-otp-27
export MISE_ELIXIR_VERSION=1.17.2-otp-27

$ mise current elixir
1.15.8-otp-25

$ mise shell elixir@1.17.2-otp-27
# no output

$ mise current elixir
1.17.2-otp-27

Expected behavior
mise sh should operate the same as mise shell, i.e. setting the Elixir version in the example above.

mise doctor output

version: 2024.9.0 linux-x64 (c83103c 2024-09-05)
activated: yes
shims_on_path: no

build_info:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Thu, 5 Sep 2024 00:43:09 +0000
  Rust Version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)
  Profile: release

shell:
  /usr/bin/zsh
  zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:
  ~/.config/mise/config.toml
  ~/dev/forks/lexical/.tool-versions

backends:
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:
  elixir  https://github.com/asdf-vm/asdf-elixir.git#a4c42e1
  erlang  https://github.com/asdf-vm/asdf-erlang.git#4468afe
  gleam   https://github.com/vic/asdf-gleam.git#b45a651
  shfmt   https://github.com/luizm/asdf-shfmt.git#a42c5ff
  usage   https://github.com/jdx/mise-usage.git#fe3888a
  yarn    https://github.com/twuni/asdf-yarn.git#376c540
  zig     https://github.com/cheetah/asdf-zig.git#9d11e5b

toolset:
  elixir@1.17.2-otp-27
  erlang@25.3.2.13
  shfmt@3.8.0
  python@3.12.3
  yarn@1.22.19
  go@1.22.4
  node@20.15.0
  usage@0.3.1

env_vars:
  MISE_SHELL=zsh
  MISE_ELIXIR_VERSION=1.17.2-otp-27

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf = true
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_hints = []
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  pipx_uvx = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "~/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  use_versions_host = true
  verbose = false
  vfox = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

2 warnings found:

1. plugin erlang overrides a core plugin

2. plugin zig overrides a core plugin

No problems found

Additional context

Trace for mise sh:

$ mise sh elixir@1.17.2-otp-27 --trace
[DEBUG] (1) mise::cli: [src/cli/mod.rs:218] ARGS: /home/zacha/.local/bin/mise sh elixir@1.17.2-otp-27 --trace
[TRACE] (1) mise::config: [src/config/mod.rs:69] Settings: Settings {
  ... omitted ...
}
[TRACE] (4) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/yarn/.mise.backend.json
[TRACE] (3) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/node/.mise.backend.json
[TRACE] (6) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/ruby/.mise.backend.json
[TRACE] (7) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/go/.mise.backend.json
[TRACE] (4) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/elixir/.mise.backend.json
[TRACE] (5) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/python/.mise.backend.json
[TRACE] (3) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/shfmt/.mise.backend.json
[TRACE] (2) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/usage/.mise.backend.json
[TRACE] (11) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/erlang/.mise.backend.json
[TRACE] (10) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/gleam/.mise.backend.json
[TRACE] (6) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/zig/.mise.backend.json
[TRACE] (5) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/elixir/legacy_filenames-d3e61.msgpack.z
[TRACE] (4) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/yarn/legacy_filenames-d3e61.msgpack.z
[TRACE] (2) mise::config::config_file::tool_versions: [src/config/config_file/tool_versions.rs:52] parsing tool-versions: /home/zacha/dev/forks/lexical/.tool-versions
[TRACE] (3) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:85] parsing: ~/.config/mise/config.toml
[TRACE] (3) mise::file: [src/file.rs:130] cat ~/.config/mise/config.toml
[TRACE] (2) mise::file: [src/file.rs:130] cat ~/dev/forks/lexical/.tool-versions
[TRACE] (3) mise::file: [src/file.rs:130] cat ~/.config/mise/config.toml
[TRACE] (3) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:98] [tools]
shfmt = "latest"
python = "3.12.3"
yarn = "1.22.19"
erlang = "27.0.1"
elixir = "1.17.2-otp-27"
go = "1.22.4"
node = "20.15"
usage = "latest"

[settings]
experimental = true

[TRACE] (2) mise::config::config_file::tool_versions: [src/config/config_file/tool_versions.rs:74] ToolVersions(~/dev/forks/lexical/.tool-versions): elixir@1.15.8-otp-25, erlang@25
[DEBUG] (1) mise::config: [src/config/mod.rs:90] Config {
    Config Files: [
        "~/dev/forks/lexical/.tool-versions",
        "~/.config/mise/config.toml",
    ],
}
[DEBUG] (1) mise::toolset::builder: [src/toolset/builder.rs:48] Toolset (642.265µs): elixir@1.17.2-otp-27, erlang@25, shfmt@latest, python@3.12.3, yarn@1.22.19, go@1.22.4, node@20.15, usage@latest
export MISE_ELIXIR_VERSION=1.17.2-otp-27

Trace for mise shell:

$ mise shell elixir@1.17.2-otp-27 --trace
[DEBUG] (1) mise::cli: [src/cli/mod.rs:218] ARGS: /home/zacha/.local/bin/mise shell elixir@1.17.2-otp-27 --trace
[TRACE] (1) mise::config: [src/config/mod.rs:69] Settings: Settings {
  ... omitted ...
}
[TRACE] (2) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/ruby/.mise.backend.json
[TRACE] (4) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/node/.mise.backend.json
[TRACE] (3) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/usage/.mise.backend.json
[TRACE] (6) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/go/.mise.backend.json
[TRACE] (2) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/python/.mise.backend.json
[TRACE] (13) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/elixir/.mise.backend.json
[TRACE] (5) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/yarn/.mise.backend.json
[TRACE] (10) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/zig/.mise.backend.json
[TRACE] (9) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/gleam/.mise.backend.json
[TRACE] (16) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/shfmt/.mise.backend.json
[TRACE] (8) mise::file: [src/file.rs:130] cat ~/.local/share/mise/installs/erlang/.mise.backend.json
[TRACE] (4) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/elixir/legacy_filenames-d3e61.msgpack.z
[TRACE] (3) mise::cache: [src/cache.rs:87] reading ~/.cache/mise/yarn/legacy_filenames-d3e61.msgpack.z
[TRACE] (2) mise::config::config_file::tool_versions: [src/config/config_file/tool_versions.rs:52] parsing tool-versions: /home/zacha/dev/forks/lexical/.tool-versions
[TRACE] (3) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:85] parsing: ~/.config/mise/config.toml
[TRACE] (3) mise::file: [src/file.rs:130] cat ~/.config/mise/config.toml
[TRACE] (2) mise::file: [src/file.rs:130] cat ~/dev/forks/lexical/.tool-versions
[TRACE] (3) mise::file: [src/file.rs:130] cat ~/.config/mise/config.toml
[TRACE] (3) mise::config::config_file::mise_toml: [src/config/config_file/mise_toml.rs:98] [tools]
shfmt = "latest"
python = "3.12.3"
yarn = "1.22.19"
erlang = "27.0.1"
elixir = "1.17.2-otp-27"
go = "1.22.4"
node = "20.15"
usage = "latest"

[settings]
experimental = true

[TRACE] (2) mise::config::config_file::tool_versions: [src/config/config_file/tool_versions.rs:74] ToolVersions(~/dev/forks/lexical/.tool-versions): elixir@1.15.8-otp-25, erlang@25
[DEBUG] (1) mise::config: [src/config/mod.rs:90] Config {
    Config Files: [
        "~/dev/forks/lexical/.tool-versions",
        "~/.config/mise/config.toml",
    ],
}
[DEBUG] (1) mise::toolset::builder: [src/toolset/builder.rs:48] Toolset (652.778µs): elixir@1.17.2-otp-27, erlang@25, shfmt@latest, python@3.12.3, yarn@1.22.19, go@1.22.4, node@20.15, usage@latest