1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::path::PathBuf;
use mz_protoc::Protoc;
#[derive(clap::Parser)]
#[clap(rename_all = "snake")]
struct Args {
#[clap(short = 'I', long, value_name = "PATH")]
proto_path: Vec<String>,
#[clap(long, required = true, value_name = "OUT_DIR")]
rust_out: PathBuf,
#[clap(required = true, value_name = "PROTO_FILES")]
proto_files: Vec<String>,
}
fn main() -> anyhow::Result<()> {
let args: Args = ore::cli::parse_args();
let mut protoc = Protoc::new();
for path in args.proto_path {
protoc.include(path);
}
for path in &args.proto_files {
protoc.input(path);
}
protoc.compile_into(&args.rust_out)
}