rules_rust/tools/action_args
UebelAndre fa943c7f16
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>
2024-10-01 18:42:22 +00:00
..
BUILD.bazel Added utility for parsing action Args param files (#2897) 2024-10-01 18:42:22 +00:00
action_args.rs Added utility for parsing action Args param files (#2897) 2024-10-01 18:42:22 +00:00