MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / getKeyValueArgs

Function getKeyValueArgs

commands/commands.go:96–115  ·  view source on GitHub ↗
(args []string, argIndex int, parsedArgs []string)

Source from the content-addressed store, hash-verified

94func init() {}
95
96func 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
117func getValueFromArgs(args []string, argIndex int, parsedArgs []string) ([]string, []string, error) {
118 var whiskErr error

Callers 1

parseArgsFunction · 0.85

Calls 1

getFormattedJSONFunction · 0.85

Tested by

no test coverage detected