dubee commented on a change in pull request #479: Trigger parameter issue
URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r378527279
##########
File path: commands/trigger.go
##########
@@ -436,47 +442,108 @@ func (t *Trigger) Create(Client *whisk.Client, args
[]string) error {
return NewQualifiedNameError(args[0], err)
}
- paramArray := Flags.common.param
annotationArray := Flags.common.annotation
- feedParam := Flags.common.feed
authToken := Client.Config.AuthToken
// if a feed is specified, create additional parameters which must be
passed to the feed
- feedName, feedParams := feedParameters(feedParam, FEED_CREATE,
triggerName, authToken)
- // the feed receives all the parameters that are specified on the
command line so we merge
- // the feed lifecycle parameters with the command line ones
- parameters := getParameters(append(paramArray, feedParams...), feedName
== nil, false)
+ feedQualifiedName, additionalFeedParams :=
feedParameters(Flags.common.feed, FEED_CREATE, triggerName, authToken)
// if a feed is specified, add feed annotation the annotations declared
on the command line
// TODO: add test to ensure that generated annotation has precedence
- if feedName != nil {
- annotationArray = append(annotationArray,
getFormattedJSON("feed", feedName.GetFullQualifiedName()))
+ if feedQualifiedName != nil {
+ annotationArray = append(annotationArray,
getFormattedJSON("feed", feedQualifiedName.GetFullQualifiedName()))
}
annotations := getParameters(annotationArray, true, true)
+ //Within this if statement, we process users' trigger command using the
old way.
Review comment:
This is quite a large method with over 100 lines of code. Generally large
functions are hard to follow and should be broken out into several functions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services