1 use args::{Arg, ArgFlags, ArgSettings};
2 
3 #[derive(Debug, Clone, Default)]
4 pub struct Base<'a, 'b>
5 where
6     'a: 'b,
7 {
8     pub name: &'a str,
9     pub help: Option<&'b str>,
10     pub long_help: Option<&'b str>,
11     pub blacklist: Option<Vec<&'a str>>,
12     pub settings: ArgFlags,
13     pub r_unless: Option<Vec<&'a str>>,
14     pub overrides: Option<Vec<&'a str>>,
15     pub groups: Option<Vec<&'a str>>,
16     pub requires: Option<Vec<(Option<&'b str>, &'a str)>>,
17 }
18 
19 impl<'n, 'e> Base<'n, 'e> {
new(name: &'n str) -> Self20     pub fn new(name: &'n str) -> Self {
21         Base {
22             name: name,
23             ..Default::default()
24         }
25     }
26 
set(&mut self, s: ArgSettings)27     pub fn set(&mut self, s: ArgSettings) { self.settings.set(s); }
unset(&mut self, s: ArgSettings)28     pub fn unset(&mut self, s: ArgSettings) { self.settings.unset(s); }
is_set(&self, s: ArgSettings) -> bool29     pub fn is_set(&self, s: ArgSettings) -> bool { self.settings.is_set(s) }
30 }
31 
32 impl<'n, 'e, 'z> From<&'z Arg<'n, 'e>> for Base<'n, 'e> {
from(a: &'z Arg<'n, 'e>) -> Self33     fn from(a: &'z Arg<'n, 'e>) -> Self { a.b.clone() }
34 }
35 
36 impl<'n, 'e> PartialEq for Base<'n, 'e> {
eq(&self, other: &Base<'n, 'e>) -> bool37     fn eq(&self, other: &Base<'n, 'e>) -> bool { self.name == other.name }
38 }
39