rsapi/commands.go
func (a *API) findParamAndValue(action *metadata.Action, flag string) (*metadata.ActionParam, string, error) {
	elems := strings.SplitN(flag, "=", 2)
	if len(elems) != 2 {
		return nil, "", fmt.Errorf("Arguments must be of the form NAME=VALUE, value provided was '%s'", flag)
	}
	name := elems[0]
	value := elems[1]
	var param *metadata.ActionParam
	for _, ap := range action.CommandFlags {
		if ap.Name == name {
			param = ap
			break
		}
	}
	if param == nil && strings.Contains(name, "[") {
		// Handle enumerable case
		name = name[:strings.LastIndex(name, "[")]
		for _, ap := range action.CommandFlags {
			if ap.Name == name {
				param = ap
				es := captureEnumRegex.FindStringSubmatch(elems[0])
				if es == nil {
					return nil, "", fmt.Errorf("Key/value arguments must be of the form NAME[KEY]=VALUE, value provided was '%s'", flag)
				}
				value = es[1] + "=" + value
				break
			}
		}
	}
	return param, value, nil
}
func (a *API) findParamAndValue(action *metadata.Action, flag string) (*metadata.ActionParam, string, error) {
	elems := strings.SplitN(flag, "=", 2)
	if len(elems) != 2 {
		return nil, "", fmt.Errorf("Arguments must be of the form NAME=VALUE, value provided was '%s'", flag)
	}
	name := elems[0]
	value := elems[1]
	var param *metadata.ActionParam
	for _, ap := range action.CommandFlags {
		if ap.Name == name {
			param = ap
			break
		}
	}
	if param == nil && strings.Contains(name, "[") {
		// Handle enumerable case
		name = name[:strings.LastIndex(name, "[")]
		for _, ap := range action.CommandFlags {
			if ap.Name == name {
				param = ap
				es := captureEnumRegex.FindStringSubmatch(elems[0])
				if es == nil {
					return nil, "", fmt.Errorf("Key/value arguments must be of the form NAME[KEY]=VALUE, value provided was '%s'", flag)
				}
				value = es[1] + "=" + value
				break
			}
		}
	}
	return param, value, nil
}
// Extract parameter from metadata that correspond to given command line flag
// The flag is of the form "NAME=VALUE", the one complication is for the "enumerable" case where
// the flag is of the form "NAME[KEY]=VALUE" (e.g. inputs).
// First check if there is a parameter with the given flag name, then check for the enumerable case
// if not found.