jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.38k stars 262 forks source link

`mise use` sets tool priority order reverse of expectation #2232

Closed johnpyp closed 4 months ago

johnpyp commented 4 months ago

Describe the bug Mise sets the version priority when using mise use in reverse order from what I think is expected.

For example...

mise use -g java@17 java@21 java@8 results in:

I'd expect this to result in the exact same ordering that I put when using mise use in the first place. Maybe this is intentional, though to me this unexpected (goes against the "principle of least surprise").

To Reproduce Steps to reproduce the behavior.

  1. mise use -g java@17 java@21 java@8 (or presumably any tool)
  2. Confirm that the first tool on path is the same as the last argument to the mise use command
  3. Confirm that the written mise.toml (global or local) ends up with an array with entries reverse of the args given to the cli.

Expected behavior

I'd expect the order of tool priority to reflect the same order of arguments in mise use

mise doctor output

version: 2024.5.27 macos-arm64 (2024-05-31)
activated: yes
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Fri, 31 May 2024 02:31:10 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin23.0)
# etc...
# Let me know if you need more specific output...

Additional context N/A