-
-
Notifications
You must be signed in to change notification settings - Fork 769
fix(cli): handle mise help without requiring tasks
#6961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously, running `mise help` (without `--help`) would fail with "no tasks defined" error when no tasks were configured in the current directory. This happened because the help argument was being treated as a task name, triggering config loading and task resolution. This fix adds special handling for the "help" argument in two places: 1. In the preprocessor, to prevent "help" from being converted to "run help" 2. In get_command(), to exit early with help output for help-related args Now `mise help`, `mise --help`, and `mise -h` all work consistently, regardless of whether tasks are configured. Fixes #6947 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where running mise help (without the --help flag) would fail with a "no tasks defined" error when no tasks were configured. The issue occurred because "help" was being interpreted as a task name, triggering unnecessary config loading and task resolution.
Key Changes:
- Added special case handling in the argument preprocessor to prevent "help" from being treated as a task name
- Added early exit logic in
get_command()to display help output when help-related arguments are detected - Added comprehensive e2e test coverage for all help command variants
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/cli/mod.rs | Added special case handling for help arguments in preprocessor and get_command() to prevent help from being treated as a task |
| e2e/cli/test_help_without_tasks | New e2e test verifying mise help, mise --help, and mise -h work without task configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Handle special case: "help", "-h", or "--help" as task should print help | ||
| if task == "help" || task == "-h" || task == "--help" { |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks if task equals '-h' or '--help', but these flags would have been parsed by clap as CLI flags, not as task names. Only 'help' can reach this point as a task value. The additional checks for '-h' and '--help' are unreachable and should be removed.
| // Handle special case: "help", "-h", or "--help" as task should print help | |
| if task == "help" || task == "-h" || task == "--help" { | |
| // Handle special case: "help" as task should print help | |
| if task == "help" { |
| TEMP_DIR=$(mktemp -d) | ||
| cd "$TEMP_DIR" |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cleanup section uses 'cd -' which assumes the previous directory is still in the directory stack. If the script fails before reaching cleanup, the temp directory won't be removed. Consider using a trap to ensure cleanup on exit: trap 'rm -rf \"$TEMP_DIR\"' EXIT
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.3 x -- echo |
19.1 ± 0.9 | 18.2 | 27.7 | 1.00 ± 0.05 |
mise x -- echo |
19.1 ± 0.4 | 18.2 | 20.6 | 1.00 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.3 env |
18.3 ± 0.3 | 17.7 | 19.6 | 1.00 |
mise env |
18.8 ± 0.7 | 17.7 | 23.4 | 1.03 ± 0.04 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.3 hook-env |
18.4 ± 0.3 | 17.7 | 19.8 | 1.00 |
mise hook-env |
18.7 ± 0.5 | 17.9 | 21.4 | 1.02 ± 0.03 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.11.3 ls |
15.9 ± 0.3 | 15.4 | 17.7 | 1.00 |
mise ls |
16.6 ± 0.6 | 15.6 | 18.5 | 1.05 ± 0.04 |
xtasks/test/perf
| Command | mise-2025.11.3 | mise | Variance |
|---|---|---|---|
| install (cached) | 105ms | 109ms | -3% |
| ls (cached) | 64ms | 65ms | -1% |
| bin-paths (cached) | 71ms | 71ms | +0% |
| task-ls (cached) | 425ms | 434ms | -2% |
Summary
Previously, running
mise help(without--help) would fail with "no tasks defined" error when no tasks were configured in the current directory. This happened because the help argument was being treated as a task name, triggering config loading and task resolution.This PR fixes the issue by adding special handling for the "help" argument in two places:
get_command(), to exit early with help output for help-related argsNow
mise help,mise --help, andmise -hall work consistently, regardless of whether tasks are configured.Test plan
e2e/cli/test_help_without_tasksthat verifies all three help variants work in a directory without tasksmise help,mise --help, andmise -hin directories with and without tasksFixes #6947
🤖 Generated with Claude Code
Note
Treat
help,--help, and-has help invocation (not tasks) and add an e2e test validating behavior without tasks.runwhen first non-flag arg ishelp,-h, or--helpinsrc/cli/mod.rs.TASKequalshelp,-h, or--help, print help and exit with code 0.e2e/cli/test_help_without_tasksto verifymise help,mise --help, andmise -hwork in a directory without tasks.Written by Cursor Bugbot for commit c817e84. This will update automatically on new commits. Configure here.