commit | fa943c7f1680d862c030c078d9fcd5bf715acd83 | [log] [tgz] |
---|---|---|
author | UebelAndre <github@uebelandre.com> | Tue Oct 01 11:42:22 2024 -0700 |
committer | GitHub <noreply@github.com> | Tue Oct 01 18:42:22 2024 +0000 |
tree | 395db27dce48417ed02680a813257bfc552ba455 | |
parent | 9390eba52c63428e1271e8475d6967e02074b8a7 [diff] |
Added utility for parsing action Args param files (#2897) This change introduces the `action_args` crate which is something I feel I keep writing in various repos now. It's original design is to make it easier to pass args to built binaries. E.g. ```rust use action_args; use clap::Parser; use runfiles::{rlocation, Runfiles}; #[command(version, about, long_about = None)] struct ClapArgs {} fn main() { let args = { let runfiles = Runfiles::create().unwrap(); let var = std::env::var("ARGS_FILE").unwrap(); let runfile = rlocation!(runfiles, var).unwrap(); let text = std::fs::read_to_string(runfile).unwrap(); let argv = action_args::parse_args(text); ClapArgs::parse_from(std::env::args().take(1).chain(argv)) }; // ... // ... // ... } ``` This utility will likely be unnecessary should https://github.com/bazelbuild/bazel/issues/16076 ever be implemented. Co-authored-by: Daniel Wagner-Hall <dawagner@gmail.com>
This repository provides rules for building Rust projects with Bazel.
General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust
.
Please refer to the full documentation.