fix(env): parse concatenated short form -Eval correctly#9456
Conversation
Greptile SummaryThis PR re-adds support for the concatenated short-flag form ( Confidence Score: 5/5This PR is safe to merge — the change is a targeted, well-tested fix with no regressions introduced. No P0 or P1 issues found. The refactored branching logic correctly handles all four flag forms ( No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[arg from iterator] --> B{starts with '-'?}
B -- No --> C{in_run_subcommand?}
C -- Yes --> D[break]
C -- No --> E{is 'run' or 'r'?}
E -- Yes --> F[set in_run_subcommand = true]
E -- No --> G[continue]
B -- Yes --> H{arg in arg_defs?\ne.g. '-E', '--env'}
H -- Yes --> I[consume next arg as value\n'-E production']
H -- No --> J{split_at_checked 2\nprefix in arg_defs?\nrest not starts with '='?}
J -- Yes --> K[push rest as value\n'-Eproduction']
J -- No --> L{split_once '='\nflag in arg_defs?}
L -- Yes --> M[push value\n'-E=production' / '--env=production']
L -- No --> N[ignore arg]
Reviews (2): Last reviewed commit: "fix(env): parse concatenated short form ..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request adds support for concatenated short-flag forms (e.g., -Eproduction) and includes E2E tests for these new forms. The review feedback suggests simplifying the flag definitions by using arrays instead of HashSet for better efficiency with small static sets. Additionally, a safety issue was identified regarding direct string slicing, which could lead to panics if multi-byte characters are encountered; using safe slicing methods like .get() is recommended to handle character boundaries correctly.
In the past, mise would correctly parse `-Eval` (vs e.g. `-E val`) such that `mise.val.toml` would be loaded. Currently `mise -Eval <cmd>` silently fails to load the `val` environment. This change re-adds support for this "concatenated short" form to the parser. See also PR jdx#8889, which previously fixed support for `--env=val` and `-E=val` forms.
a0e962b to
0e0d39b
Compare
### 🚀 Features - **(deps)** add aube provider by @jdx in [#9452](#9452) - **(ls-remote)** add strict metadata mode by @jdx in [#9448](#9448) ### 🐛 Bug Fixes - **(env)** parse concatenated short form `-Eval` correctly by @bts in [#9456](#9456) - **(http)** improve HTML detection by using Content-Type header by @phateffect in [#9407](#9407) - **(task)** install monorepo subdir tools before running deps by @jdx in [#9454](#9454) ### 📦️ Dependency Updates - update astral-tokio-tar advisory by @jdx in [#9449](#9449) - respect -q flag for provider command stream by @JamBalaya56562 in [#9457](#9457) ### New Contributors - @JamBalaya56562 made their first contribution in [#9457](#9457) - @bts made their first contribution in [#9456](#9456) - @phateffect made their first contribution in [#9407](#9407) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
In the past, mise would correctly parse
-Eval(vs e.g.-E val) such thatmise.val.tomlwould be loaded. Currentlymise -Eval <cmd>silently fails to load thevalenvironment.This change re-adds support for this "concatenated short" form to the parser.
See also PR #8889, which previously fixed support for
--env=valand-E=valforms.