fn do_single_command(args: &Args, projects: &mut GlProjects) -> Result<bool> {
    match &args.command {
        Command::Path { project } => {
            if let Some(project) = projects.projects.get(project) {
                println!("{}", &project.path.display());
            } else {
                return Err(Error::ProjectNotFound(project.into()));
            }
            Ok(true)
        }
        Command::List { fetch_url, path } => {
            for (name, project) in &projects.projects {
                print!("{}", name);
                if *fetch_url {
                    print!(",{}", project.fetch_url);
                }
                if *path {
                    print!(",{}", &project.path.display());
                }
                println!();
            }
            Ok(true)
        }
        Command::Create {
            run_command,
            project_name,
            path,
            fetch_url,
            reference,
            auto_sync,
            timeout_ms,
        } => {
            if projects.projects.get(project_name).is_some() {
                return Err(Error::General(format!(
                    "Project: '{}' already exists",
                    project_name
                )));
            }
            let repo = Git::init(path)?;
            repo.remote("origin", fetch_url)?;
            projects.insert(
                project_name,
                manifest::GlProject {
                    name: project_name.to_string(),
                    path: path.clone(),
                    fetch_url: fetch_url.clone(),
                    reference: reference.clone(),
                    auto_sync: *auto_sync,
                },
            );
            projects.save_to_yaml(&args.gl_manifest)?;
            if let Err(e) = process::spawn_shell_and_wait(
                project_name,
                path,
                run_command.into(),
                std::time::Duration::from_millis(*timeout_ms),
            ) {
                return Err(e);
            }

            Ok(true)
        }
        _ => Ok(false),
    }
}
///
/// Do the command specified via command line
/// Only global actions is run here.
/// If an command was run return true else false.
/// If command failed it returns an Error.
///
/// # Arguments
/// * `args` - Command line argument data.
/// * `projects` Projects data structure.
///
/// # Error
///
/// see GlRepo::error::Error
Do the command specified via command line
Only global actions is run here.
If an command was run return true else false.
If command failed it returns an Error.
Do the command specified via command line Only global actions is run here . If an command was run return true else false . If command failed it returns an Error .
fn do_single_command(args: &Args, projects: &mut GlProjects) -> Result<bool> {
    match &args.command {
        Command::Path { project } => {
            if let Some(project) = projects.projects.get(project) {
                println!("{}", &project.path.display());
            } else {
                return Err(Error::ProjectNotFound(project.into()));
            }
            Ok(true)
        }
        Command::List { fetch_url, path } => {
            for (name, project) in &projects.projects {
                print!("{}", name);
                if *fetch_url {
                    print!(",{}", project.fetch_url);
                }
                if *path {
                    print!(",{}", &project.path.display());
                }
                println!();
            }
            Ok(true)
        }
        Command::Create {
            run_command,
            project_name,
            path,
            fetch_url,
            reference,
            auto_sync,
            timeout_ms,
        } => {
            if projects.projects.get(project_name).is_some() {
                return Err(Error::General(format!(
                    "Project: '{}' already exists",
                    project_name
                )));
            }
            let repo = Git::init(path)?;
            repo.remote("origin", fetch_url)?;
            projects.insert(
                project_name,
                manifest::GlProject {
                    name: project_name.to_string(),
                    path: path.clone(),
                    fetch_url: fetch_url.clone(),
                    reference: reference.clone(),
                    auto_sync: *auto_sync,
                },
            );
            projects.save_to_yaml(&args.gl_manifest)?;
            if let Err(e) = process::spawn_shell_and_wait(
                project_name,
                path,
                run_command.into(),
                std::time::Duration::from_millis(*timeout_ms),
            ) {
                return Err(e);
            }
            Ok(true)
        }
        _ => Ok(false),
    }
}
fn do_single_command ( args : & Args , projects : & mut GlProjects ) -> Result < bool > { match & args . command { Command :: Path { project } => { if let Some ( project ) = projects . projects . get ( project ) { println ! ( " " project path display ( ) ) ; } else { return Err ( Error :: ProjectNotFound ( project . into ( ) ) ) ; } Ok ( true ) } Command :: List { fetch_url , path } => { for ( name , project ) in & projects . projects { print ! ( " " name ) ; if * fetch_url { print ! ( " " project fetch_url ) ; } if * path { print ! ( " " project path display ( ) ) ; } println ! ( ) ; } Ok ( true ) } Command :: Create { run_command , project_name , path , fetch_url , reference , auto_sync , timeout_ms , } => { if projects . projects . get ( project_name ) . is_some ( ) { return Err ( Error :: General ( format ! ( " " project_name ) ) ) ; } let repo = Git :: init ( path ) ? ; repo . remote ( " " , fetch_url ) ? ; projects . insert ( project_name , manifest :: GlProject { name : project_name . to_string ( ) , path : path . clone ( ) , fetch_url : fetch_url . clone ( ) , reference : reference . clone ( ) , auto_sync : * auto_sync , } , ) ; projects . save_to_yaml ( & args . gl_manifest ) ? ; if let Err ( e ) = process :: spawn_shell_and_wait ( project_name , path , run_command . into ( ) , std :: time :: Duration :: from_millis ( * timeout_ms ) , ) { return Err ( e ) ; } Ok ( true ) } _ => Ok ( false ) , } }
Do the command specified via command line
Only global actions is run here.
Do the command specified via command line Only global actions is run here .
args
&Args
projects
&mut GlProjects
args
&Args
projects
&mut GlProjects
error
None