func (m *yamlManager) AddOrgToConfig(orgConfig *OrgConfig, spaces *Spaces) error {
	orgList, err := m.Orgs()
	if err != nil {
		return err
	}
	orgName := orgConfig.Org
	if orgName == "" {
		return errors.New("cannot have an empty org name")
	}

	if orgList.Contains(orgName) {
		return fmt.Errorf("org [%s] already added to config -> %v", orgName, orgList.Orgs)
	}
	lo.G.Infof("Adding org: %s ", orgName)
	orgList.Orgs = append(orgList.Orgs, orgName)
	if err = m.SaveOrgs(orgList); err != nil {
		return err
	}
	m.SaveOrgConfig(orgConfig)
	return m.SaveOrgSpaces(spaces)
}
func (m *yamlManager) AddOrgToConfig(orgConfig *OrgConfig, spaces *Spaces) error {
	orgList, err := m.Orgs()
	if err != nil {
		return err
	}
	orgName := orgConfig.Org
	if orgName == "" {
		return errors.New("cannot have an empty org name")
	}

	if orgList.Contains(orgName) {
		return fmt.Errorf("org [%s] already added to config -> %v", orgName, orgList.Orgs)
	}
	lo.G.Infof("Adding org: %s ", orgName)
	orgList.Orgs = append(orgList.Orgs, orgName)
	if err = m.SaveOrgs(orgList); err != nil {
		return err
	}
	m.SaveOrgConfig(orgConfig)
	return m.SaveOrgSpaces(spaces)
}
func ( m * yamlManager ) AddOrgToConfig ( orgConfig * OrgConfig , spaces * Spaces ) error { orgList , err := m . Orgs ( ) if err != nil { return err } orgName := orgConfig . Org if orgName == " " { return errors . New ( " " ) } if orgList . Contains ( orgName ) { return fmt . Errorf ( " " , orgName , orgList . Orgs ) } lo . G . Infof ( " " , orgName ) orgList . Orgs = append ( orgList . Orgs , orgName ) if err = m . SaveOrgs ( orgList ) ; err != nil { return err } m . SaveOrgConfig ( orgConfig ) return m . SaveOrgSpaces ( spaces ) }
// AddOrgToConfig adds an organization to the cf-mgmt configuration.
AddOrgToConfig adds an organization to the cf - mgmt configuration .