argley

Crates.ioargley
lib.rsargley
version1.3.0
sourcesrc
created_at2023-06-17 19:21:10.163206
updated_at2023-07-08 19:49:09.548248
descriptionTurn a struct into arguments for a `Command`
homepage
repositoryhttps://github.com/Alorel/argley-rs
max_upload_size
id893082
size27,499
Art (Alorel)

documentation

README

master CI badge crates.io badge docs.rs badge dependencies badge

Turn a struct into arguments for a Command.

use argley::prelude::*;

#[derive(Args)]
struct Args<'a> {
  compress: bool,
  
  #[arg(rename = "dir")]
  output_dir: &'a Path,
  
  #[arg(variadic)]
  input_files: Vec<&'a Path>,
}

let args = Args {
  compress: true,
  output_dir: Path::new("./output"),
  input_files: vec![Path::new("./foo.txt"), Path::new("./bar.txt")],
};

let output = Command::new("some-application")
  .add_arg_set(&args)
  .output()
  .unwrap();

Support for async-std and tokio can be enabled via their respective features.

See crate-level docs for detailed configuration options.

Commit count: 19

cargo fmt