Preserve CLI unit spellings in Clap support - #1370
Merged
Merged
Conversation
Allow units-of-measure types (e.g. volume, length) to be used by `clap` for deserializing command line args from strings into those enums.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1370 +/- ##
=======================================
Coverage ? 35.73%
=======================================
Files ? 37
Lines ? 1858
Branches ? 0
=======================================
Hits ? 664
Misses ? 1194
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JordanNoone
marked this pull request as ready for review
September 7, 2026 04:15
Contributor
Author
|
@adamchalmers ready for review. Resolved the conflict with Changes here:
KittyCAD/cli#1844 now parses directly into the modeling-command enums and removes the conversion helper, as requested. All 11 checks pass on |
adamchalmers
approved these changes
Sep 7, 2026
JordanNoone
pushed a commit
that referenced
this pull request
Sep 7, 2026
# Changed - Clap strings for UoM should match serde/display strings (#1370)
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.
Enabling the unit enums' new
clapfeature rejects existing abbreviations such asm,kg, andkg:m3, including the CLI's own default arguments.UnitVolumealso lacksValueEnum, and enabling this feature alone fails to compile because Clap's requiredstdfeature is disabled.Preserve the existing 31 unit spellings and density aliases, add
ValueEnumtoUnitVolume, and enableclap/std. Parsing stays on the modeling-command enums without API-to-modeling conversions. Clap remains optional.This PR completes the Clap unit support merged in #1369, targets
main, and supports KittyCAD/cli#1844.Validation:
cargo +1.98.1 check -p kittycad-modeling-cmds --no-default-features --locked --offlinepasses.cargo +1.98.1 clippy -p kittycad-modeling-cmds --features clap --all-targets --locked --offline -- -D warningspasses.