mirror of
https://github.com/Noratrieb/badargs.git
synced 2026-01-14 19:55:08 +01:00
improve docs
This commit is contained in:
parent
341b3ae26c
commit
6054c988a0
1 changed files with 16 additions and 13 deletions
|
|
@ -52,21 +52,25 @@ macro_rules! arg {
|
|||
/// This macro lets you specify your arguments in a flat list, and then converts them into
|
||||
/// nested tuples for you, since that's what's internally used.
|
||||
/// ```
|
||||
/// # use badargs::arg;
|
||||
/// # arg!(Force: "force", 'f' -> bool);
|
||||
/// # arg!(OutFile: "outfile", 't' -> bool);
|
||||
/// # arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
||||
/// # fn main() {
|
||||
/// let args = badargs::badargs!(Force, OutFile, SetUpstream);
|
||||
/// # }
|
||||
/// use badargs::arg;
|
||||
/// arg!(Force: "force", 'f' -> bool);
|
||||
/// arg!(OutFile: "outfile", 't' -> bool);
|
||||
/// arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
||||
///
|
||||
/// fn main() {
|
||||
/// let args = badargs::badargs!(Force, OutFile, SetUpstream);
|
||||
/// }
|
||||
/// ```
|
||||
/// will be expanded into
|
||||
/// ```
|
||||
/// # use badargs::arg;
|
||||
/// # arg!(Force: "force", 'f' -> bool);
|
||||
/// # arg!(OutFile: "outfile", 't' -> bool);
|
||||
/// # arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
||||
/// let args = badargs::badargs::<(Force, (OutFile, SetUpstream))>();
|
||||
/// use badargs::arg;
|
||||
/// arg!(Force: "force", 'f' -> bool);
|
||||
/// arg!(OutFile: "outfile", 't' -> bool);
|
||||
/// arg!(SetUpstream: "set-upstream", 'x' -> bool);
|
||||
///
|
||||
/// fn main() {
|
||||
/// let args = badargs::badargs::<(Force, (OutFile, SetUpstream))>();
|
||||
/// }
|
||||
/// ```
|
||||
/// This only provides a minor benefit for programs with a small amount of args, but is
|
||||
/// very useful for larger arg amounts.
|
||||
|
|
@ -82,7 +86,6 @@ macro_rules! badargs {
|
|||
{
|
||||
#[allow(unused_parens)] // allow this because there might only be one arg
|
||||
{
|
||||
|
||||
$crate::badargs::<($crate::badargs!(@inner $($tail),+))>()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue