6 个版本 (稳定版)

1.3.0 2023年7月8日
1.1.2 2023年6月17日
1.0.0 2023年6月17日
0.1.0 2023年6月17日

#1493开发工具

Apache-2.0

18KB
282 代码行

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

将结构体转换为 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();

可以通过各自的特性启用对 async-stdtokio 的支持。

请参阅 crate 级别的文档以获取详细的配置选项。

依赖项

~0–10MB
~101K SLoC