embassy-rs / chiptool

Apache License 2.0
37 stars 21 forks source link

add `keep_desc` option to `DeleteEnums` and `MergeEnums` transform #18

Closed eZioPan closed 5 months ago

eZioPan commented 5 months ago

concat variant descriptions of a enum, then append to related field description

take a look at embassy-rs/stm32-data#358 for a example

Dirbaio commented 5 months ago

if the main use case is keeping docs while deleting enums, maybe it should be an option in the DeleteEnum transform?

eZioPan commented 5 months ago

@Dirbaio Ok, I will close this and make another pr

Dirbaio commented 5 months ago

actually, sorry I saw this later, but

you're also using it for copying descriptions before a merge, not a delete. I hadn't thought of that.

  - !CopyVariantDescToField
    enums: .*_FMP
  - !MergeEnums
    from: .*_FMP
    to: FMP

Having a separate transform makes sense then!

Or alternatively it could be a field copy_variant_desc_to_fields: true in both DeleteEnums and MergeEnums :thinking: The field might be better because then you don't have to duplicate the from regex in the transform yaml.

eZioPan commented 5 months ago

got it, I will try do the implementation.

eZioPan commented 5 months ago

@Dirbaio I'v try add keep_desc option to DeleteEnums and MergeEnums. Would you take a look?