/// PARAMS: index = the index of the repository.
/// creates a symlink of the desired repository in
/// the user's current directory. Also records the
/// path of the link in the self.open_link datamember.
index = the index of the repository.
creates a symlink of the desired repository in
the user's current directory. Also records the
path of the link in the self.open_link datamember.
index = the index of the repository . creates a symlink of the desired repository in the user ' s current directory . Also records the path of the link in the self . open_link datamember .
pub fn open_repo(&mut self, index: usize) -> Result<()> {
        if self.open_link == "" {
            let path = utils::prefix_home(".gee/tmp/").to_owned()
                + utils::prettify_url(&self.repositories[index - 1].url);
            let link = String::from("./") + utils::prettify_url(&self.repositories[index - 1].url);
            self.open_link = String::from(utils::return_curr_dir())
                + "/"
                + utils::prettify_url(&self.repositories[index - 1].url);
            if !utils::dir_exists(&link) {
                self.write_data()?;
                unix::fs::symlink(path, link)?;
                println!(
                    "successfully opened {} in your current directory.",
                    utils::prettify_url(&self.repositories[index - 1].url)
                );
            } else {
                println!("this repository is already open, type 'gee done' to close.");
            }
        } else {
            println!("you already have a repository open, type 'gee done' to close.");
        }
        Ok(())
    }
pub fn open_repo ( & mut self , index : usize ) -> Result < ( ) > { if self . open_link == " " { let path = utils :: prefix_home ( " " ) . to_owned ( ) + utils :: prettify_url ( & self . repositories [ index - 1 ] . url ) ; let link = String :: from ( " " ) + utils :: prettify_url ( & self . repositories [ index - 1 ] . url ) ; self . open_link = String :: from ( utils :: return_curr_dir ( ) ) + " " + utils :: prettify_url ( & self . repositories [ index - 1 ] . url ) ; if ! utils :: dir_exists ( & link ) { self . write_data ( ) ? ; unix :: fs :: symlink ( path , link ) ? ; println ! ( " " utils prettify_url ( self repositories [ index 1 ] url ) ) ; } else { println ! ( " " ) ; } } else { println ! ( " " ) ; } Ok ( ( ) ) }
PARAMS: index = the index of the repository.
PARAMS : index = the index of the repository .
&mut self
index
usize