Skip to content

Commit

Permalink
Add support for enum attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
rasviitanen committed Apr 25, 2024
1 parent 30f30b4 commit fc1e3f7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions proto-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)>,
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -232,6 +240,7 @@ message TestMessage {
generate_transport: false,
disable_comments: vec![],
type_attributes: vec![],
enum_attributes: vec![],
client_attributes: vec![],
server_attributes: vec![],
};
Expand Down Expand Up @@ -379,6 +388,7 @@ message NestedTransitiveMsg {
generate_transport: false,
disable_comments: vec![],
type_attributes: vec![],
enum_attributes: vec![],
client_attributes: vec![],
server_attributes: vec![],
};
Expand Down

0 comments on commit fc1e3f7

Please sign in to comment.