@@ -101,13 +101,18 @@ fn parse_with(s: &str) -> Result<(String, WithOption), String> {
101101
102102#[ derive( Default , Debug , Clone ) ]
103103#[ cfg_attr( feature = "clap" , derive( clap:: Parser ) ) ]
104+ #[ cfg_attr(
105+ feature = "serde" ,
106+ derive( serde:: Deserialize ) ,
107+ serde( default , rename_all = "kebab-case" )
108+ ) ]
104109pub struct Opts {
105110 /// Whether or not a formatter is executed to format generated code.
106111 #[ cfg_attr( feature = "clap" , arg( long) ) ]
107112 pub format : bool ,
108113
109114 /// Names of functions to skip generating bindings for.
110- #[ cfg_attr( feature = "clap" , arg( long) ) ]
115+ #[ cfg_attr( feature = "clap" , arg( long, value_name = "NAME" ) ) ]
111116 pub skip : Vec < String > ,
112117
113118 /// The optional path to the bitflags crate to use.
@@ -120,7 +125,7 @@ pub struct Opts {
120125 /// specified multiple times to add multiple attributes.
121126 ///
122127 /// These derive attributes will be added to any generated structs or enums
123- #[ cfg_attr( feature = "clap" , arg( long, short = 'd' ) ) ]
128+ #[ cfg_attr( feature = "clap" , arg( long, short = 'd' , value_name = "DERIVE" ) ) ]
124129 pub additional_derive_attributes : Vec < String > ,
125130
126131 /// Variants and records to ignore when applying additional derive attributes.
@@ -129,7 +134,7 @@ pub struct Opts {
129134 /// This feature allows some variants and records to use types for which adding traits will cause
130135 /// compilation to fail, such as serde::Deserialize on wasi:io/streams.
131136 ///
132- #[ cfg_attr( feature = "clap" , arg( long) ) ]
137+ #[ cfg_attr( feature = "clap" , arg( long, value_name = "NAME" ) ) ]
133138 pub additional_derive_ignore : Vec < String > ,
134139
135140 /// Remapping of interface names to rust module names.
@@ -152,31 +157,31 @@ pub struct Opts {
152157 /// The optional path to the `anyhow` crate to use.
153158 ///
154159 /// This defaults to `wit_bindgen_wrpc::anyhow`.
155- #[ cfg_attr( feature = "clap" , arg( long) ) ]
160+ #[ cfg_attr( feature = "clap" , arg( long, value_name = "PATH" ) ) ]
156161 pub anyhow_path : Option < String > ,
157162
158163 /// The optional path to the `bytes` crate to use.
159164 ///
160165 /// This defaults to `wit_bindgen_wrpc::bytes`.
161- #[ cfg_attr( feature = "clap" , arg( long) ) ]
166+ #[ cfg_attr( feature = "clap" , arg( long, value_name = "PATH" ) ) ]
162167 pub bytes_path : Option < String > ,
163168
164169 /// The optional path to the `futures` crate to use.
165170 ///
166171 /// This defaults to `wit_bindgen_wrpc::futures`.
167- #[ cfg_attr( feature = "clap" , arg( long) ) ]
172+ #[ cfg_attr( feature = "clap" , arg( long, value_name = "PATH" ) ) ]
168173 pub futures_path : Option < String > ,
169174
170175 /// The optional path to the `tokio` crate to use.
171176 ///
172177 /// This defaults to `wit_bindgen_wrpc::tokio`.
173- #[ cfg_attr( feature = "clap" , arg( long) ) ]
178+ #[ cfg_attr( feature = "clap" , arg( long, value_name = "PATH" ) ) ]
174179 pub tokio_path : Option < String > ,
175180
176181 /// The optional path to the `tokio-util` crate to use.
177182 ///
178183 /// This defaults to `wit_bindgen_wrpc::tokio_util`.
179- #[ cfg_attr( feature = "clap" , arg( long) ) ]
184+ #[ cfg_attr( feature = "clap" , arg( long, value_name = "PATH" ) ) ]
180185 pub tokio_util_path : Option < String > ,
181186
182187 /// The optional path to the `tracing` crate to use.
@@ -773,6 +778,11 @@ enum Identifier<'a> {
773778
774779/// Options for with "with" remappings.
775780#[ derive( Debug , Clone ) ]
781+ #[ cfg_attr(
782+ feature = "serde" ,
783+ derive( serde:: Deserialize ) ,
784+ serde( rename_all = "kebab-case" )
785+ ) ]
776786pub enum WithOption {
777787 Path ( String ) ,
778788 Generate ,
0 commit comments