diff --git a/proto-gen/CHANGELOG.md b/proto-gen/CHANGELOG.md index a21f3c4..6f79b44 100644 --- a/proto-gen/CHANGELOG.md +++ b/proto-gen/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate +### Added +- [PR#23](https://github.com/EmbarkStudios/proto-gen/pull/23) Added `--enum-attribute` option to set enum attributes. + ## [0.2.5] - 2024-03-13 ### Fixed - [PR#22](https://github.com/EmbarkStudios/proto-gen/pull/22) Various fixes for the `--prepend-header` option and some cases for escaped doc-tests. diff --git a/proto-gen/src/main.rs b/proto-gen/src/main.rs index 16aa1f5..c87bd3e 100644 --- a/proto-gen/src/main.rs +++ b/proto-gen/src/main.rs @@ -61,6 +61,10 @@ struct TonicOpts { #[clap(long = "type-attribute", value_parser=KvValueParser)] type_attributes: Vec<(String, String)>, + /// Enum attributes to add. + #[clap(long = "enum-attribute", value_parser=KvValueParser)] + enum_attributes: Vec<(String, String)>, + /// Client mod attributes to add. #[clap(long = "client-attribute", value_parser=KvValueParser)] client_attributes: Vec<(String, String)>, @@ -125,6 +129,10 @@ fn run_with_opts(opts: Opts) -> Result<(), i32> { bldr = bldr.type_attribute(k, v); } + for (k, v) in opts.tonic.enum_attributes { + bldr = bldr.enum_attribute(k, v); + } + for (k, v) in opts.tonic.client_attributes { bldr = bldr.client_mod_attribute(k, v); } @@ -232,6 +240,7 @@ message TestMessage { generate_transport: false, disable_comments: vec![], type_attributes: vec![], + enum_attributes: vec![], client_attributes: vec![], server_attributes: vec![], }; @@ -379,6 +388,7 @@ message NestedTransitiveMsg { generate_transport: false, disable_comments: vec![], type_attributes: vec![], + enum_attributes: vec![], client_attributes: vec![], server_attributes: vec![], };