6 releases (stable)

1.3.0 Jul 8, 2023
1.1.2 Jun 17, 2023
1.0.0 Jun 17, 2023
0.1.0 Jun 17, 2023

#891 in Development tools

Apache-2.0

18KB
282 lines

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.

Dependencies

~0–13MB
~123K SLoC