Skip to content

Replace magic index-to-variant mapping in Select prompts#110

Merged
lukidoescode merged 2 commits intomainfrom
lwagner/96-replace-magic-index-to-variant-mapping
Apr 17, 2026
Merged

Replace magic index-to-variant mapping in Select prompts#110
lukidoescode merged 2 commits intomainfrom
lwagner/96-replace-magic-index-to-variant-mapping

Conversation

@lukidoescode
Copy link
Copy Markdown
Owner

Introduces strum-annotated CLI-local mirror enums (*SelectionOption) that carry display labels and map to domain types via From impls, eliminating fragile positional index matching. Adds select_variant and select_from_options helpers as the single interface to dialoguer::Select.

- Resolves #96

Introduces strum-annotated CLI-local mirror enums (*SelectionOption) that
carry display labels and map to domain types via From impls, eliminating
fragile positional index matching. Adds select_variant and
select_from_options helpers as the single interface to dialoguer::Select.
- Extract 8 mirror enums into dedicated interaction/selection_options.rs submodule (SRP)
- Replace unwrap_or("") with expect() in select_variant for missing strum annotations
- Add debug_assert! bounds check on default index in select_variant
- Replace From<AdditionalPackageFieldSelectionOption> for Option<AdditionalPackageField>
  with an inherent into_field() method; update call site in additional_packages.rs
- Add tests for cli_error_to_operation_error in commands/mod.rs
- Add test for From<dialoguer::Error> for CliError in error.rs
@lukidoescode lukidoescode merged commit 6f03b7b into main Apr 17, 2026
14 checks passed
@lukidoescode lukidoescode deleted the lwagner/96-replace-magic-index-to-variant-mapping branch April 17, 2026 23:38
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.

Replace magic index-to-variant mapping in Select prompts

1 participant