|
@@ -11,12 +11,16 @@ fn main() {
|
|
|
let matches = app().get_matches();
|
|
|
|
|
|
if let Some(ref matches) = matches.subcommand_matches("pb-gen") {
|
|
|
- let rust_source = matches.value_of("rust_source").unwrap();
|
|
|
+ let rust_sources: Vec<String> = matches
|
|
|
+ .values_of("rust_sources")
|
|
|
+ .unwrap()
|
|
|
+ .map(|value| value.to_owned())
|
|
|
+ .collect();
|
|
|
let derive_meta = matches.value_of("derive_meta").unwrap();
|
|
|
let flutter_package_lib = matches.value_of("flutter_package_lib").unwrap();
|
|
|
|
|
|
proto::ProtoGenBuilder::new()
|
|
|
- .set_rust_source_dir(rust_source)
|
|
|
+ .set_rust_source_dirs(rust_sources)
|
|
|
.set_derive_meta_dir(derive_meta)
|
|
|
.set_flutter_package_lib(flutter_package_lib)
|
|
|
.build()
|
|
@@ -24,11 +28,15 @@ fn main() {
|
|
|
}
|
|
|
|
|
|
if let Some(ref matches) = matches.subcommand_matches("dart-event") {
|
|
|
- let rust_source = matches.value_of("rust_source").unwrap().to_string();
|
|
|
+ let rust_sources: Vec<String> = matches
|
|
|
+ .values_of("rust_sources")
|
|
|
+ .unwrap()
|
|
|
+ .map(|value| value.to_owned())
|
|
|
+ .collect();
|
|
|
let output_dir = matches.value_of("output").unwrap().to_string();
|
|
|
|
|
|
let code_gen = dart_event::DartEventCodeGen {
|
|
|
- rust_source,
|
|
|
+ rust_sources,
|
|
|
output_dir,
|
|
|
};
|
|
|
code_gen.gen();
|
|
@@ -44,10 +52,13 @@ pub fn app<'a, 'b>() -> App<'a, 'b> {
|
|
|
App::new("pb-gen")
|
|
|
.about("Generate proto file from rust code")
|
|
|
.arg(
|
|
|
- Arg::with_name("rust_source")
|
|
|
- .long("rust_source")
|
|
|
+ Arg::with_name("rust_sources")
|
|
|
+ .long("rust_sources")
|
|
|
+ .multiple(true)
|
|
|
+ .required(true)
|
|
|
+ .min_values(1)
|
|
|
.value_name("DIRECTORY")
|
|
|
- .help("Directory of the cargo workspace"),
|
|
|
+ .help("Directories of the cargo workspace"),
|
|
|
)
|
|
|
.arg(
|
|
|
Arg::with_name("derive_meta")
|
|
@@ -65,10 +76,13 @@ pub fn app<'a, 'b>() -> App<'a, 'b> {
|
|
|
App::new("dart-event")
|
|
|
.about("Generate the codes that sending events from rust ast")
|
|
|
.arg(
|
|
|
- Arg::with_name("rust_source")
|
|
|
- .long("rust_source")
|
|
|
+ Arg::with_name("rust_sources")
|
|
|
+ .long("rust_sources")
|
|
|
+ .multiple(true)
|
|
|
+ .required(true)
|
|
|
+ .min_values(1)
|
|
|
.value_name("DIRECTORY")
|
|
|
- .help("Directory of the cargo workspace"),
|
|
|
+ .help("Directories of the cargo workspace"),
|
|
|
)
|
|
|
.arg(
|
|
|
Arg::with_name("output")
|