orcs 0.0.8

Microservices monorepo orchestration tool
Documentation
use crate::Error;
use crate::{get_all_services, Project, Service};
use clap::ArgMatches;
use tracing::{info, instrument};

#[instrument(skip(subcommand))]
pub fn load(project_path: &str, subcommand: &ArgMatches) -> Result<(), Error> {
    info!("Load project configuration");
    // Retrieve the project
    let project = Project::from_path(project_path)?;

    match subcommand.value_of("name") {
        Some(service_name) => {
            let service = Service::from_name(project, service_name)?;
            println!("service: {:?}", service);
        }
        None => {
            println!("project: {:?}", project);
            for (name, service) in get_all_services(project)? {
                println!("service {}: {:?}", name, service);
            }
        }
    }
    Ok(())
}