/*
FindResource
Return a Resource reference that matches the argument. The format of the
argument is "<project_slug>.<resource_slug>" */
FindResource
Return a Resource reference that matches the argument. The format of the
argument is "."
/ * FindResource Return a Resource reference that matches the argument . The format of the argument is " <project_slug > . <resource_slug > " * /
func (cfg *Config) FindResource(id string) *Resource {
	parts := strings.Split(id, ".")
	if len(parts) != 2 {
		return nil
	}
	projectSlug := parts[0]
	resourceSlug := parts[1]
	for i := range cfg.Local.Resources {
		resource := &cfg.Local.Resources[i]
		if resource.ProjectSlug == projectSlug &&
			resource.ResourceSlug == resourceSlug {
			return resource
		}
	}
	return nil
}
func ( cfg * Config ) FindResource ( id string ) * Resource { parts := strings . Split ( id , " " ) if len ( parts ) != 2 { return nil } projectSlug := parts [ 0 ] resourceSlug := parts [ 1 ] for i := range cfg . Local . Resources { resource := & cfg . Local . Resources [ i ] if resource . ProjectSlug == projectSlug && resource . ResourceSlug == resourceSlug { return resource } } return nil }
FindResource
Return a Resource reference that matches the argument.
FindResource Return a Resource reference that matches the argument .
// range returns copies: https://stackoverflow.com/q/20185511