feat(shell-hook): validate --shell against the shells it accepts - #6685
Open
hunger wants to merge 1 commit into
Open
feat(shell-hook): validate --shell against the shells it accepts#6685hunger wants to merge 1 commit into
hunger wants to merge 1 commit into
Conversation
`--shell` was a plain `Option<ShellEnum>` with the accepted names written out by hand in the doc-string, so the list went stale. `rattler_shell` gained the bash flavors `sh`, `dash`, `ksh` and `busybox`, plus `brush`, `nu` and `powershell_ise`, while `--help` and the CLI reference still named only the original seven. `-s sh` worked and nothing in pixi said so. A typo got a bare parse error with no alternatives, and completion had no candidates to offer. Listing the names `ShellEnum`'s `FromStr` accepts in a `PossibleValuesParser` lets clap reject an unknown shell with the alternatives, show the set in `--help`, and offer it in every generated completion script. The doc-string drops the hand-maintained list and states the default instead. The list copies names `rattler_shell` cannot enumerate, so two tests hold it in step: every listed name must still parse, and an exhaustive match over `ShellEnum` plus a variant count catches a shell no listed name reaches. Neither notices a new alias for an existing variant, and the flavors behind `ShellEnum::Bash` cannot be guarded the same way because `BashFlavor` is `#[non_exhaustive]`. Refs prefix-dev#5495
hunger
force-pushed
the
push-uryomknqqvrt
branch
from
July 30, 2026 09:35
453d59d to
6eb7785
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--shellwas a plainOption<ShellEnum>with the accepted names written out by hand in the doc-string, so the list went stale.rattler_shellgained the bash flavorssh,dash,kshandbusybox, plusbrush,nuandpowershell_ise, while--helpand the CLI reference still named only the original seven.-s shworked and nothing in pixi said so. A typo got a bare parse error with no alternatives, and completion had no candidates to offer.Listing the names
ShellEnum'sFromStraccepts in aPossibleValuesParserlets clap reject an unknown shell with the alternatives, show the set in--help, and offer it in every generated completion script. The doc-string drops the hand-maintained list and states the default instead.The list copies names
rattler_shellcannot enumerate, so two tests hold it in step: every listed name must still parse, and an exhaustive match overShellEnumplus a variant count catches a shell no listed name reaches. Neither notices a new alias for an existing variant, and the flavors behindShellEnum::Bashcannot be guarded the same way becauseBashFlavoris#[non_exhaustive].Refs #5495
AI Disclosure
Tools: Claude
Checklist:
schema/model.py.