mdeuser commented on a change in pull request #2544: Allow CLI to Save Code 
from Action
URL: 
https://github.com/apache/incubator-openwhisk/pull/2544#discussion_r144967923
 
 

 ##########
 File path: tools/cli/go-whisk-cli/commands/action.go
 ##########
 @@ -495,6 +513,87 @@ func getExec(args []string, params ActionFlags) 
(*whisk.Exec, error) {
     return exec, nil
 }
 
+func getBinaryKindExtension(kind string) (extension string){
+    switch strings.ToLower(kind) {
+    case JAVA:
+        extension = JAVA_EXT
+    default:
+        extension = ZIP_EXT
+    }
+
+    return extension
+}
+
+func getKindExtension(kind string) (extension string){
+    switch strings.ToLower(kind) {
+    case NODE_JS:
+        extension = NODE_JS_EXT
+    case PYTHON:
+        extension = PYTHON_EXT
+    case SWIFT:
+        fallthrough
+    case PHP:
+        extension = "." + kind
+    }
+
+    return extension
+}
+
+func saveCode(action whisk.Action, filename string) (err error) {
+    var code string
+    var kind string
+    var exec whisk.Exec
+
+    exec = *action.Exec
+    kind = strings.Split(exec.Kind, ":")[0]
 
 Review comment:
   nit.  possible confusion by using `kind` as the variable name when it really 
holds the runtime name and not the entire kind value.  i.e. `nodejs:6` is the 
action's exec.kind value; this `kind` var will be set to `nodejs`.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to