1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Turn a struct into arguments for a [`Command`](::std::process::Command). See the
//! [derive macro](argley_macro::Arg) for options you can pass in.
//!
//! ```
//!# use argley::prelude::*;
//!# use std::path::{Path, PathBuf};
//!# use std::ptr;
//!# use std::process::Command;
//!
//! #[derive(Arg)]
//! struct BasicArgs<'a> {
//! #[arg(position = 1)]
//! str_ref: &'a str,
//!
//! #[arg(variadic)]
//! number: u8,
//!
//! #[arg(rename = "p", short)]
//! path: PathBuf,
//! opt_skipped: Option<String>,
//!
//! #[arg(position = 0)]
//! opt_present: Option<&'static str>,
//!
//! false_arg: bool,
//! true_arg: bool,
//!
//! #[arg(skip)]
//! _skipped_arg: *const u8,
//! empty_collection: Vec<&'a Path>,
//! full_collection: Vec<String>,
//! }
//!
//! let args = BasicArgs {
//! str_ref: "hello",
//! number: 42,
//! path: Path::new("world").to_owned(),
//! opt_skipped: None,
//! opt_present: Some("present".into()),
//! false_arg: false,
//! true_arg: true,
//! _skipped_arg: ptr::null(),
//! empty_collection: Vec::new(),
//! full_collection: vec!["a".into(), "b".into()],
//! };
//!
//! let mut command = Command::new("foo");
//! command.add_arg_set(&args);
//!
//! let resulting_args = command.get_args().collect::<Vec<_>>();
//! assert_eq!(&resulting_args[..], &[
//! "-p",
//! "world",
//! "--true_arg",
//! "--full_collection",
//! "a",
//! "b",
//! "present",
//! "hello",
//! "42",
//! ]);
//! ```
//!
//! Support for [`async-std`](async_std) and [`tokio`] can be enabled via their respective features.
pub use Arg;
pub use ;