(args []string, argIndex int, parsedArgs []string)
| 94 | func init() {} |
| 95 | |
| 96 | func getKeyValueArgs(args []string, argIndex int, parsedArgs []string) ([]string, []string, error) { |
| 97 | var whiskErr error |
| 98 | var key string |
| 99 | var value string |
| 100 | |
| 101 | if len(args)-1 >= argIndex+2 { |
| 102 | key = args[argIndex+1] |
| 103 | value = args[argIndex+2] |
| 104 | parsedArgs = append(parsedArgs, getFormattedJSON(key, value)) |
| 105 | args = append(args[:argIndex], args[argIndex+3:]...) |
| 106 | } else { |
| 107 | whisk.Debug(whisk.DbgError, "Arguments for '%s' must be a key/value pair; args: %s", args[argIndex], args) |
| 108 | errMsg := wski18n.T("Arguments for '{{.arg}}' must be a key/value pair", |
| 109 | map[string]interface{}{"arg": args[argIndex]}) |
| 110 | whiskErr = whisk.MakeWskError(errors.New(errMsg), whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, |
| 111 | whisk.DISPLAY_USAGE) |
| 112 | } |
| 113 | |
| 114 | return parsedArgs, args, whiskErr |
| 115 | } |
| 116 | |
| 117 | func getValueFromArgs(args []string, argIndex int, parsedArgs []string) ([]string, []string, error) { |
| 118 | var whiskErr error |
no test coverage detected