Skip to content

feat(config): accept --path on mise config get and mise config set - #11640

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:feat/config-get-set-path-alias
Aug 2, 2026
Merged

feat(config): accept --path on mise config get and mise config set#11640
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:feat/config-get-set-path-alias

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Last step of the option-name ladder from #4881. mise use names its config-file option --path and mise set names it --file; #11577, #11616 and #11631 made the two names interchangeable across nine commands. config get and config set were the last two still taking it under one name.

Measured on v2026.8.0:

mise config get --path mise.toml tools.jq error: unexpected argument '--path' found
mise config get -f mise.toml tools.jq 1.7
mise config get -f . mise ERROR Is a directory (os error 21)
mise config get -f ./nope.toml mise ERROR No such file or directory (os error 2)
mise use --path ./sub resolves to ./sub/mise.toml

So these two were also the only ones left that reject a directory. e2e/cli/test_config_target_aliases already pins "all four accept a directory as well as a file, under either name" for the commands covered so far, and adding --path to two commands that don't honor that would have created a new inconsistency rather than removing one.

Change

visible_alias = "path" on both, and an explicitly named target now goes through resolve_target_config_path with prefer_toml: true — the same resolver set, unset, dotfiles add and the bootstrap packages commands use. A directory resolves to the config file inside it; prefer_toml matters here because config_file_in_dir can hand back .tool-versions under asdf_compat, which these two would then feed to a TOML parser.

The default — no option given — deliberately stays on top_toml_config(). The resolver's own default is local_toml_config_path_from_dir, a different rule, so routing that through it would have changed behavior for everyone not passing the option.

With directories resolved, the only remaining failure is a path that resolves to nothing, so both raw io errors collapse into a single config file not found: <path> naming the resolved target.

These two do not create the file. mise use --path <dir> does; config get/config set have always required an existing file (they read it, then edit the parsed document), and creating one is a separate behavior change. A directory with no config therefore resolves to <dir>/mise.toml and reports it as not found.

Also corrected while regenerating the docs: config get's option said "the mise.toml file to edit" on a read-only command.

Tests

  • src/cli/mod.rs — two rows added to test_config_target_options_accept_both_names, the clap-introspection test that asserts the visible alias exists on every command in the ladder
  • e2e/cli/test_config_target_aliases — both names against a file, both names against a directory, and the three not-found paths (missing file via get, empty directory via get and via set)

Summary by CodeRabbit

  • New Features

    • Added --path as an alias for --file in config get and config set.
    • Both commands now accept file paths or directories, automatically locating the applicable mise.toml file.
  • Bug Fixes

    • Missing configuration targets now display a clear “config file not found” error with the requested path.
  • Documentation

    • Updated command help, manuals, and usage documentation to reflect the new options and directory behavior.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

config get and config set now accept --path as an alias for --file. Explicit file and directory targets resolve to configuration files, with clear errors for missing targets. CLI tests and command documentation cover the behavior.

Changes

Configuration target handling

Layer / File(s) Summary
Resolve config targets
src/cli/config/get.rs, src/cli/config/set.rs
Both commands resolve explicit file or directory targets and report missing configuration files.
Validate aliases and target behavior
e2e/cli/test_config_target_aliases, src/cli/mod.rs
Tests cover --file, --path, directory targets, and missing configuration files.
Update command references
docs/cli/config/*, man/man1/mise.1, mise.usage.kdl
Command documentation describes the alias and file-or-directory target behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ConfigCommand
  participant resolve_target_config_path
  participant mise.toml
  ConfigCommand->>resolve_target_config_path: resolve explicit file or directory target
  resolve_target_config_path->>mise.toml: select configuration file
  mise.toml-->>ConfigCommand: return resolved configuration path
  ConfigCommand->>ConfigCommand: report config file not found when absent
Loading

Possibly related PRs

  • jdx/mise#11116: Modifies the same config command aliases and CLI tests.
  • jdx/mise#11575: Modifies shared configuration target resolution.
  • jdx/mise#11609: Modifies config get/set handling of file and directory targets.

Suggested reviewers: greptile-apps

Poem

A rabbit chose a config path,
And found mise.toml in its path.
--path joined --file today,
Missing targets name the way.
TOML waits where targets stay.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding --path as an alias for mise config get and mise config set.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes --path a visible alias for --file on mise config get and mise config set, while preserving existing no-option target selection.

  • Explicit directory targets now resolve to their TOML configuration file.
  • Missing explicit targets receive a consistent config file not found error.
  • CLI documentation and alias/path-resolution tests are updated.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/cli/config/get.rs Adds the --path alias and resolves explicit file or directory targets while preserving default config selection.
src/cli/config/set.rs Applies the same explicit-target resolution and missing-file handling before editing an existing TOML document.
e2e/cli/test_config_target_aliases Covers both option names, file and directory targets, and missing-target diagnostics.
src/cli/mod.rs Extends clap introspection coverage to require the new visible aliases.
mise.usage.kdl Updates generated command usage and help text to document the aliases and directory behavior.

Reviews (2): Last reviewed commit: "feat(config): accept --path on `mise con..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
e2e/cli/test_config_target_aliases (1)

91-93: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the resolved path in the error.

The assertions at Lines 91-93 only match config file not found. They would pass if the path were missing or incorrect. Assert path-specific fragments such as nope.toml and emptydir/mise.toml.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/cli/test_config_target_aliases` around lines 91 - 93, Update the three
config-file-not-found assertions to verify the resolved path as well as the
existing error text: require “nope.toml” for the explicit missing file case and
“emptydir/mise.toml” for both empty-directory cases, preserving the current
command coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/cli/config/get.md`:
- Around line 20-22: Document the visible --path alias alongside --file in both
docs/cli/config/get.md lines 20-22 and docs/cli/config/set.md lines 26-27,
adding it to each command’s usage and flag heading while preserving the existing
descriptions.
- Around line 20-22: Update the default-target wording for ConfigGet::run to
state that, when no explicit target is provided, top_toml_config() is used
instead of the nearest mise.toml. Apply the same documentation change in
docs/cli/config/get.md lines 20-22 and man/man1/mise.1 lines 1574-1577.

---

Nitpick comments:
In `@e2e/cli/test_config_target_aliases`:
- Around line 91-93: Update the three config-file-not-found assertions to verify
the resolved path as well as the existing error text: require “nope.toml” for
the explicit missing file case and “emptydir/mise.toml” for both empty-directory
cases, preserving the current command coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ca8e2e7-002b-45de-a8d2-f09596931828

📥 Commits

Reviewing files that changed from the base of the PR and between 529e27e and c7b94ac.

📒 Files selected for processing (8)
  • docs/cli/config/get.md
  • docs/cli/config/set.md
  • e2e/cli/test_config_target_aliases
  • man/man1/mise.1
  • mise.usage.kdl
  • src/cli/config/get.rs
  • src/cli/config/set.rs
  • src/cli/mod.rs

Comment thread docs/cli/config/get.md
Completes the option-name ladder from jdx#4881: every command that names a
config file now takes both --file and --path.

These two were also the only ones left that rejected a directory, landing on
a bare `Is a directory (os error 21)` while the rest resolve a directory to
the config file inside it. They now go through the same resolver, and a
target that resolves to nothing names itself instead of surfacing a raw io
error.

The default (no option given) stays on top_toml_config() — the resolver's own
default is a different rule and would have changed that behavior.

Reported in jdx#4881
@JamBalaya56562
JamBalaya56562 force-pushed the feat/config-get-set-path-alias branch from c7b94ac to 6eaf7c5 Compare August 2, 2026 13:48
Comment thread docs/cli/config/get.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/cli/config/get.md`:
- Around line 20-22: Update the documentation text describing the mise.toml path
so the directory behavior uses the complete sentence “This can be a file path or
directory.”
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: f55a0b5b-834e-45df-90ae-924811fa5458

📥 Commits

Reviewing files that changed from the base of the PR and between c7b94ac and 6eaf7c5.

📒 Files selected for processing (8)
  • docs/cli/config/get.md
  • docs/cli/config/set.md
  • e2e/cli/test_config_target_aliases
  • man/man1/mise.1
  • mise.usage.kdl
  • src/cli/config/get.rs
  • src/cli/config/set.rs
  • src/cli/mod.rs
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/cli/mod.rs
  • docs/cli/config/set.md
  • src/cli/config/set.rs
  • e2e/cli/test_config_target_aliases
  • man/man1/mise.1
  • mise.usage.kdl
  • src/cli/config/get.rs

Comment thread docs/cli/config/get.md
@jdx
jdx merged commit dd68c19 into jdx:main Aug 2, 2026
30 checks passed
@JamBalaya56562
JamBalaya56562 deleted the feat/config-get-set-path-alias branch August 2, 2026 22:20
donbeave pushed a commit to donbeave/mise that referenced this pull request Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants