/// PARAMS: none.
/// tries to read in configurations from the
/// .geerc file if it exists. if not it will
/// load in default configurations, and will
/// assign the configurations to the config datamember.  
none.
tries to read in configurations from the
.geerc file if it exists. if not it will
load in default configurations, and will
assign the configurations to the config datamember.
none . tries to read in configurations from the . geerc file if it exists . if not it will load in default configurations and will assign the configurations to the config datamember .
pub fn parse_conf(&mut self) {
        if utils::file_exists(&utils::prefix_home(".geerc")) {
            let file = File::open(utils::prefix_home(".geerc")).unwrap();
            let reader = BufReader::new(file);
            let mut token_found = false;
            let mut queue_size_found = false;
            for line in reader.lines() {
                let line = line.unwrap();
                let mut split_line = line.split_whitespace();
                let key = split_line.next().expect("failed to parse the .geerc file");
                let value = split_line.next().expect("failed to parse the .geerc file");
                if key == "queue_size" {
                    let value: usize = value
                        .trim()
                        .parse()
                        .expect("failed to convert &str value to i32");
                    self.config.queue_size = value;
                    queue_size_found = true;
                } else if key == "github_token" {
                    let value: String = value
                        .trim()
                        .parse()
                        .expect("failed to convert &str to String");
                    self.config.github_token = value;
                    token_found = true;
                } else {
                    let mut output = "unknown key: ".to_owned();
                    output.push_str(key);
                    output.push_str(" found in file '.geerc', now using default configurations.");
                    println!("{}", output);
                }
            }
            if !token_found {
                self.config.github_token = "".to_string();
            }
            if !queue_size_found {
                self.config.queue_size = 5;
            }
        }
    }
pub fn parse_conf ( & mut self ) { if utils :: file_exists ( & utils :: prefix_home ( " " ) ) { let file = File :: open ( utils :: prefix_home ( " " ) ) . unwrap ( ) ; let reader = BufReader :: new ( file ) ; let mut token_found = false ; let mut queue_size_found = false ; for line in reader . lines ( ) { let line = line . unwrap ( ) ; let mut split_line = line . split_whitespace ( ) ; let key = split_line . next ( ) . expect ( " " ) ; let value = split_line . next ( ) . expect ( " " ) ; if key == " " { let value : usize = value . trim ( ) . parse ( ) . expect ( " " ) ; self . config . queue_size = value ; queue_size_found = true ; } else if key == " " { let value : String = value . trim ( ) . parse ( ) . expect ( " " ) ; self . config . github_token = value ; token_found = true ; } else { let mut output = " " . to_owned ( ) ; output . push_str ( key ) ; output . push_str ( " " ) ; println ! ( " " output ) ; } } if ! token_found { self . config . github_token = " " . to_string ( ) ; } if ! queue_size_found { self . config . queue_size = 5 ; } } }
PARAMS: none.
PARAMS : none .
&mut self