      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
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130

    macro_rules! remove_overriden {
        ($me:ident, $name:expr) => ({
            if let Some(ref o) = $me.opts.iter().filter(|o| &o.name == $name).next() {
                if let Some(ref ora) = o.requires {
                    for a in ora {
                        vec_remove!($me.required, a);
                    }
                }
                if let Some(ref ora) = o.blacklist {
                    for a in ora {
                        vec_remove!($me.blacklist, a);
                    }
                }
                if let Some(ref ora) = o.overrides {
                    for a in ora {
                        vec_remove!($me.overrides, a);
                    }
                }
            } else if let Some(ref o) = $me.flags.iter().filter(|f| &f.name == $name).next() {
                if let Some(ref ora) = o.requires {
                    for a in ora {
                        vec_remove!($me.required, a);
                    }
                }
                if let Some(ref ora) = o.blacklist {
                    for a in ora {
                        vec_remove!($me.blacklist, a);
                    }
                }
                if let Some(ref ora) = o.overrides {
                    for a in ora {
                        vec_remove!($me.overrides, a);
                    }
                }
            } else if let Some(p) = $me.positionals.values().filter(|p| &&p.name == &$name).next() {
                if let Some(ref ora) = p.requires {
                    for a in ora {
                        vec_remove!($me.required, a);
                    }
                }
                if let Some(ref ora) = p.blacklist {
                    for a in ora {
                        vec_remove!($me.blacklist, a);
                    }
                }
                if let Some(ref ora) = p.overrides {
                    for a in ora {
                        vec_remove!($me.overrides, a);
                    }
                }
            }
        })
    }

    macro_rules! arg_post_processing(
        ($me:ident, $arg:ident, $matcher:ident) => ({
            use args::AnyArg;
            // Handle POSIX overrides
            if $me.overrides.contains(&$arg.name()) {
                if let Some(ref name) = $me.overriden_from($arg.name(), $matcher) {
                    $matcher.remove(name);
                    remove_overriden!($me, name);
                }
            }
            if let Some(or) = $arg.overrides() {
                for pa in or {
                    $matcher.remove(pa);
                    remove_overriden!($me, pa);
                    $me.overrides.push(pa);
                    vec_remove!($me.required, pa);
                }
            }
            // Handle conflicts
            if let Some(bl) = $arg.blacklist() {
                for name in bl {
                    $me.blacklist.push(name);
                    vec_remove!($me.overrides, name);
                    vec_remove!($me.required, name);
                }
            }

            // Add all required args which aren't already found in matcher to the master
            // list
            if let Some(reqs) = $arg.requires() {
                for n in reqs {
                    if $matcher.contains(n) {
                        continue;
                    }

                    $me.required.push(n);
                }
            }

            _handle_group_reqs!($me, $arg);
        })
    );

    macro_rules! _handle_group_reqs{
        ($me:ident, $arg:ident) => ({
            use args::AnyArg;
            for grp in $me.groups.values() {
                let mut found = false;
                for name in grp.args.iter() {
                    if name == &$arg.name() {
                        vec_remove!($me.required, name);
                        if let Some(ref reqs) = grp.requires {
                            for r in reqs {
                                $me.required.push(r);
                            }
                        }
                        if let Some(ref bl) = grp.conflicts {
                            for b in bl {
                                $me.blacklist.push(b);
                            }
                        }
                        found = true;
                        break;
                    }
                }
                if found {
                    for name in grp.args.iter() {
                        if name == &$arg.name() { continue }
                        vec_remove!($me.required, name);

                        $me.blacklist.push(name);
                    }
                }
            }
        })
    }

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)