Skip to content

capnpc-rust: make CLI plugin aware of default_parent_module #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions capnpc/src/capnpc-rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@
pub fn main() {
//! Generates Rust code according to a `schema_capnp::code_generator_request` read from stdin.

::capnpc::codegen::CodeGenerationCommand::new()
.output_directory(::std::path::Path::new("."))
.run(::std::io::stdin())
let mut cmd = ::capnpc::codegen::CodeGenerationCommand::new();
cmd.output_directory(::std::path::Path::new("."));

Check warning on line 32 in capnpc/src/capnpc-rust.rs

View check run for this annotation

Codecov / codecov/patch

capnpc/src/capnpc-rust.rs#L31-L32

Added lines #L31 - L32 were not covered by tests

if let Ok(parent_module) = std::env::var("CAPNPC_RUST_DEFAULT_PARENT_MODULE") {
let modules = parent_module.split("::").map(ToString::to_string).collect();
cmd.default_parent_module(modules);
}

Check warning on line 37 in capnpc/src/capnpc-rust.rs

View check run for this annotation

Codecov / codecov/patch

capnpc/src/capnpc-rust.rs#L34-L37

Added lines #L34 - L37 were not covered by tests

cmd.run(::std::io::stdin())

Check warning on line 39 in capnpc/src/capnpc-rust.rs

View check run for this annotation

Codecov / codecov/patch

capnpc/src/capnpc-rust.rs#L39

Added line #L39 was not covered by tests
.expect("failed to generate code");
}
Loading