Closed risu729 closed 1 month ago
Describe the bug mise use creates a new .mise.toml even if mise.toml already exists.
mise use
.mise.toml
mise.toml
To Reproduce
mise use python
e.g.
mkdir mise-test cd mise-test echo -e "[tools]\nnode = \"latest\"" >> mise.toml cat mise.toml # [tools] # node = "latest" mise use --verbose python cat .mise.toml # [tools] # python = "latest"
Then, ls -a shows both mise.toml and .mise.toml.
ls -a
Expected behavior python is written in already existing mise.toml instead of the new .mise.toml
python
Cause mise use seems only to look for MISE_DEFAULT_CONFIG_FILENAME, the env value, or the default .mise.toml. https://github.com/jdx/mise/blob/9a9924e6473036468176014fdac5e8e49ee8123e/src/cli/use.rs#L180-L196
MISE_DEFAULT_CONFIG_FILENAME
I don't understand well about the codebase but it seems other commands refer to DEFAULT_CONFIG_FILENAMES in config/mod.rs. https://github.com/jdx/mise/blob/9a9924e6473036468176014fdac5e8e49ee8123e/src/config/mod.rs#L460-L500
DEFAULT_CONFIG_FILENAMES
config/mod.rs
Workaround Settings MISE_DEFAULT_CONFIG_FILENAME=mise.toml will fix the issue.
MISE_DEFAULT_CONFIG_FILENAME=mise.toml
mise doctor output
mise doctor
version: 2024.5.23 linux-x64 (2024-05-27) activated: yes shims_on_path: yes build_info: Target: x86_64-unknown-linux-gnu Features: DEFAULT, NATIVE_TLS Built: Mon, 27 May 2024 14:51:00 +0000 Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew) Profile: release shell: /bin/bash GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. 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 ~/GitHub/mise-test/mise.toml backends: cargo core go npm pipx ubi plugins: actionlint https://github.com/crazy-matt/asdf-actionlint.git#f8df3cf bun (core) deno (core) erlang (core) go (core) java (core) markdownlint-cli2 https://github.com/paulo-ferraz-oliveira/asdf-markdownlint-cli2#3b733f6 node (core) python (core) ruby (core) rust https://github.com/code-lever/asdf-rust.git#95acf4f shellcheck https://github.com/luizm/asdf-shellcheck.git#780d78d shfmt https://github.com/luizm/asdf-shfmt.git#a42c5ff yamlfmt https://github.com/mise-plugins/asdf-yamlfmt.git#5f36f2e yamllint https://github.com/ericcornelissen/asdf-yamllint.git#e8e1d29 zig (core) toolset: node@22.2.0 bun@1.1.10 python@3.12.3 rust@1.78.0 npm:@biomejs/biome@1.7.4-nightly.125f34b env_vars: MISE_SHELL=bash settings: activate_aggressive = false all_compile = false always_keep_download = false always_keep_install = false asdf_compat = false cargo_binstall = true color = true disable_default_shorthands = false 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 jobs = 4 legacy_version_file = true legacy_version_file_disable_tools = [] node_compile = false not_found_auto_install = true paranoid = false plugin_autoupdate_last_check_duration = "7d" python_default_packages_file = "/home/risu/.default-python-packages" python_pyenv_repo = "https://github.com/pyenv/pyenv.git" raw = false trusted_config_paths = [] quiet = false verbose = 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 No warnings found No problems found
Additional context
[DEBUG] ARGS: mise use --verbose python [DEBUG] Config { Config Files: [ "~/GitHub/mise-test/mise.toml", "~/.config/mise/config.toml", ], } [DEBUG] Toolset (359.412µs): node@latest, bun@latest, python@latest, rust@latest, npm:@biomejs/biome@latest [DEBUG] install_versions: python@latest mise ~/GitHub/mise-test/.mise.toml tools: python@3.12.3
Thanks for fixing the issue and also for the awesome project!
Describe the bug
mise use
creates a new.mise.toml
even ifmise.toml
already exists.To Reproduce
.mise.toml
tomise.toml
in the directory. (Ensure to delete.mise.toml
.)mise use python
in the same directory..mise.toml
is newly created.e.g.
Then,
ls -a
shows bothmise.toml
and.mise.toml
.Expected behavior
python
is written in already existingmise.toml
instead of the new.mise.toml
Cause
mise use
seems only to look forMISE_DEFAULT_CONFIG_FILENAME
, the env value, or the default.mise.toml
. https://github.com/jdx/mise/blob/9a9924e6473036468176014fdac5e8e49ee8123e/src/cli/use.rs#L180-L196I don't understand well about the codebase but it seems other commands refer to
DEFAULT_CONFIG_FILENAMES
inconfig/mod.rs
. https://github.com/jdx/mise/blob/9a9924e6473036468176014fdac5e8e49ee8123e/src/config/mod.rs#L460-L500Workaround Settings
MISE_DEFAULT_CONFIG_FILENAME=mise.toml
will fix the issue.mise doctor
outputAdditional context