code: func UpdateOrAddToEnvlist(oldEnvSlice []models.EnvironmentItemModel, newEnv models.EnvironmentItemModel, replace bool) ([]models.EnvironmentItemModel, error) {
  	newKey, _, err := newEnv.GetKeyValuePair()
  	if err != nil {
  		return []models.EnvironmentItemModel{}, err
  	}
  
  	var newEnvs []models.EnvironmentItemModel
  	exist := false
  
  	if replace {
  		match := 0
  		for _, env := range oldEnvSlice {
  			key, _, err := env.GetKeyValuePair()
  			if err != nil {
  				return []models.EnvironmentItemModel{}, err
  			}
  
  			if key == newKey {
  				match = match + 1
  			}
  		}
  		if match > 1 {
  			if ToolMode {
  				return []models.EnvironmentItemModel{}, errors.New("More then one env exist with key '" + newKey + "'")
  			}
  			msg := "   More then one env exist with key '" + newKey + "' replace all/append ['replace/append'] ?"
  			answer, err := goinp.AskForString(msg)
  			if err != nil {
  				return []models.EnvironmentItemModel{}, err
  			}
  
  			switch answer {
  			case "replace":
  				break
  			case "append":
  				replace = false
  				break
  			default:
  				return []models.EnvironmentItemModel{}, errors.New("Failed to parse answer: '" + answer + "' use ['replace/append']!")
  			}
  		}
  	}
  
  	for _, env := range oldEnvSlice {
  		key, _, err := env.GetKeyValuePair()
  		if err != nil {
  			return []models.EnvironmentItemModel{}, err
  		}
  
  		if replace && key == newKey {
  			exist = true
  			newEnvs = append(newEnvs, newEnv)
  		} else {
  			newEnvs = append(newEnvs, env)
  		}
  	}
  
  	if !exist {
  		newEnvs = append(newEnvs, newEnv)
  	}
  
  	return newEnvs, nil
  }
docs: // -------------------
  // --- Environment handling methods
  // UpdateOrAddToEnvlist ...