/// Reads the project config if found
///
/// Projects are initialized using command-line tool:
/// ```shell
/// edgedb project init
/// ```
/// Linking to already running EdgeDB is also possible:
/// ```shell
/// edgedb project init --link
/// ```
///
/// Returns boolean value of whether project have been found


Returns boolean value of whether project have been found
Returns boolean value of whether project have been found
pub async fn read_project(&mut self,
        override_dir: Option<&Path>, search_parents: bool)
        -> Result<&mut Self, Error>
    {
        let dir = match override_dir {
            Some(v) => Cow::Borrowed(v.as_ref()),
            None => {
                Cow::Owned(env::current_dir()
                    .map_err(|e| ClientError::with_source(e)
                        .context("failed to get current directory"))?
                    .into())
            }
        };
        let dir = if search_parents {
            if let Some(ancestor) = search_dir(&dir).await? {
                Cow::Borrowed(ancestor)
            } else {
                return Ok(self);
            }
        } else {
            if !dir.join("edgedb.toml").exists().await {
                return Ok(self);
            }
            dir
        };
        let canon = fs::canonicalize(&dir).await
            .map_err(|e| ClientError::with_source(e).context(
                format!("failed to canonicalize dir {:?}", dir)
            ))?;
        let stash_path = stash_path(canon.as_ref())?;
        if AsRef::<AsyncPath>::as_ref(&stash_path).exists().await {
            let instance =
                fs::read_to_string(stash_path.join("instance-name")).await
                .map_err(|e| ClientError::with_source(e).context(
                    format!("error reading project settings {:?}", dir)
                ))?;
            self.read_instance(instance.trim()).await?;
        }
        Ok(self)
    }
pub async fn read_project ( & mut self , override_dir : Option < & Path > , search_parents : bool ) -> Result < & mut Self , Error > { let dir = match override_dir { Some ( v ) => Cow :: Borrowed ( v . as_ref ( ) ) , None => { Cow :: Owned ( env :: current_dir ( ) . map_err ( | e | ClientError :: with_source ( e ) . context ( " " ) ) ? . into ( ) ) } } ; let dir = if search_parents { if let Some ( ancestor ) = search_dir ( & dir ) . await ? { Cow :: Borrowed ( ancestor ) } else { return Ok ( self ) ; } } else { if ! dir . join ( " " ) . exists ( ) . await { return Ok ( self ) ; } dir } ; let canon = fs :: canonicalize ( & dir ) . await . map_err ( | e | ClientError :: with_source ( e ) . context ( format ! ( " " dir ) ) ) ? ; let stash_path = stash_path ( canon . as_ref ( ) ) ? ; if AsRef :: < AsyncPath > :: as_ref ( & stash_path ) . exists ( ) . await { let instance = fs :: read_to_string ( stash_path . join ( " " ) ) . await . map_err ( | e | ClientError :: with_source ( e ) . context ( format ! ( " " dir ) ) ) ? ; self . read_instance ( instance . trim ( ) ) . await ? ; } Ok ( self ) }
Reads the project config if found
Projects are initialized using command-line tool:
```shell
edgedb project init
```
Linking to already running EdgeDB is also possible:
```shell
edgedb project init --link
```
Reads the project config if found Projects are initialized using command - line tool : ` ` ` shell edgedb project init ` ` ` Linking to already running EdgeDB is also possible : ` ` ` shell edgedb project init -- link ` ` `
&mut self
<not_specific>
override_dir
Option<&Path>
<not_specific>
search_parents
bool
<not_specific>