This is an automated email from the ASF dual-hosted git repository.

berstler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ec381d  (Review) Added --last Activation Flag  (#2334)
1ec381d is described below

commit 1ec381d3ab97cee6db5c7014910648a52240d35f
Author: Benjamin Poole <[email protected]>
AuthorDate: Thu Jul 13 10:00:39 2017 -0400

    (Review) Added --last Activation Flag  (#2334)
    
    * Added lastFlag to activation logs, result and get along with docs/testing
---
 docs/actions.md                                    | 27 ++++++--
 tests/src/test/scala/common/Wsk.scala              | 35 +++++++---
 tests/src/test/scala/common/WskTestHelpers.scala   |  2 +-
 .../test/scala/system/basic/WskBasicTests.scala    | 76 ++++++++++++++++++----
 .../test/scala/system/basic/WskSequenceTests.scala |  4 +-
 tools/cli/go-whisk-cli/commands/activation.go      | 68 ++++++++++++++++++-
 tools/cli/go-whisk-cli/commands/flags.go           |  1 +
 .../go-whisk-cli/wski18n/resources/en_US.all.json  | 20 ++++++
 tools/cli/go-whisk/whisk/activation.go             |  1 -
 9 files changed, 197 insertions(+), 37 deletions(-)

diff --git a/docs/actions.md b/docs/actions.md
index b479bc9..a1538f1 100644
--- a/docs/actions.md
+++ b/docs/actions.md
@@ -106,7 +106,20 @@ Review the following steps and examples to create your 
first JavaScript action.
   }
   ```
 
-6. If you forget to record the activation ID, you can get a list of 
activations ordered from the most recent to the oldest. Run the following 
command to get a list of your activations:
+6. To access the most recent activation record, activation results or 
activation logs, use the `--last` or `-l` flag. Run the following command to 
get your last activation result.
+
+  ```
+  wsk activation result --last
+  ```
+  ```json
+  {
+      "payload": "Hello world"
+  }
+  ```
+
+  Note that you should not use an activation ID with the flag `--last`.
+
+7. If you forget to record the activation ID, you can get a list of 
activations ordered from the most recent to the oldest. Run the following 
command to get a list of your activations:
 
   ```
   wsk activation list
@@ -610,7 +623,7 @@ follows:
 wsk action create helloSwift hello.swift
 ```
 
-The CLI automatically infers the type of the action from the source file 
extension. For `.swift` source files, the action runs using a Swift 3.1.1 
runtime. You can also create an action that runs with Swift 3.0 by explicitly 
specifying the parameter `--kind swift:3`. See the Swift 
[reference](./reference.md#swift-actions) for more information about Swift 3.0 
vs. 3.1. 
+The CLI automatically infers the type of the action from the source file 
extension. For `.swift` source files, the action runs using a Swift 3.1.1 
runtime. You can also create an action that runs with Swift 3.0 by explicitly 
specifying the parameter `--kind swift:3`. See the Swift 
[reference](./reference.md#swift-actions) for more information about Swift 3.0 
vs. 3.1.
 
 **Note:** The actions you created using the kind `swift:3` will continue to 
work for a short period, however you should begin migrating your deployment 
scripts and recompiling your swift actions using the new kind `swift:3.1.1`. 
Support for Swift 3.0 is deprecated and will be removed soon.
 
@@ -644,7 +657,7 @@ To avoid the cold-start delay, you can compile your Swift 
file into a binary and
 
 - Copy the source code and prepare to build it.
   ```
-  cp /owexec/hello.swift /swift3Action/spm-build/main.swift 
+  cp /owexec/hello.swift /swift3Action/spm-build/main.swift
   ```
   ```
   cat /swift3Action/epilogue.swift >> /swift3Action/spm-build/main.swift
@@ -706,10 +719,10 @@ and so you should include them in your own 
`Package.swift`.
   wsk action update helloSwiftly hello.zip --kind swift:3.1.1
   ```
 
-- To check how much faster it is, run 
+- To check how much faster it is, run
   ```
   wsk action invoke helloSwiftly --blocking
-  ``` 
+  ```
 
 
 The time it took for the action to run is in the "duration" property and 
compare to the time it takes to run with a compilation step in the hello action.
@@ -912,7 +925,7 @@ You can use the OpenWhisk CLI to watch the output of 
actions as they are invoked
   wsk activation poll
   ```
 
-  This command starts a polling loop that continuously checks for logs from 
activations.
+This command starts a polling loop that continuously checks for logs from 
activations.
 
 2. Switch to another window and invoke an action:
 
@@ -941,7 +954,7 @@ You can list all the actions that you have created using:
 wsk action list
 ```
 
-As you write more actions, this list gets longer and it can be helpful to 
group related actions into [packages](./packages.md). To filter your list of 
actions to just the those within a specific pacakge, you can use: 
+As you write more actions, this list gets longer and it can be helpful to 
group related actions into [packages](./packages.md). To filter your list of 
actions to just the those within a specific pacakge, you can use:
 
 ```
 wsk action list [PACKAGE NAME]
diff --git a/tests/src/test/scala/common/Wsk.scala 
b/tests/src/test/scala/common/Wsk.scala
index 70d2066..d5a05eb 100644
--- a/tests/src/test/scala/common/Wsk.scala
+++ b/tests/src/test/scala/common/Wsk.scala
@@ -559,14 +559,19 @@ class WskActivation()
      * @param activationId the activation id
      * @param expectedExitCode (optional) the expected exit code for the 
command
      * if the code is anything but DONTCARE_EXIT, assert the code is as 
expected
+     * @param last retrieves latest acitvation
      */
     def get(
-        activationId: String,
+        activationId: Option[String] = None,
         expectedExitCode: Int = SUCCESS_EXIT,
-        fieldFilter: Option[String] = None)(
+        fieldFilter: Option[String] = None,
+        last: Option[Boolean] = None)(
             implicit wp: WskProps): RunResult = {
-        val params = { fieldFilter map { f => Seq(f) } getOrElse Seq() }
-        cli(wp.overrides ++ Seq(noun, "get", "--auth", wp.authKey, 
activationId) ++ params, expectedExitCode)
+        val params =
+          { activationId map { a => Seq(a) } getOrElse Seq() } ++
+          { fieldFilter map { f => Seq(f) } getOrElse Seq() } ++
+          { last map { l => Seq("--last") } getOrElse Seq() }
+        cli(wp.overrides ++ Seq(noun, "get", "--auth", wp.authKey) ++ params, 
expectedExitCode)
     }
 
     /**
@@ -575,12 +580,17 @@ class WskActivation()
      * @param activationId the activation id
      * @param expectedExitCode (optional) the expected exit code for the 
command
      * if the code is anything but DONTCARE_EXIT, assert the code is as 
expected
+     * @param last retrieves latest acitvation
      */
     def logs(
-        activationId: String,
-        expectedExitCode: Int = SUCCESS_EXIT)(
+        activationId: Option[String] = None,
+        expectedExitCode: Int = SUCCESS_EXIT,
+        last: Option[Boolean] = None)(
             implicit wp: WskProps): RunResult = {
-        cli(wp.overrides ++ Seq(noun, "logs", activationId, "--auth", 
wp.authKey), expectedExitCode)
+        val params =
+          { activationId map { a => Seq(a) } getOrElse Seq() } ++
+          { last map { l => Seq("--last") } getOrElse Seq() }
+        cli(wp.overrides ++ Seq(noun, "logs", "--auth", wp.authKey) ++ params, 
expectedExitCode)
     }
 
     /**
@@ -589,12 +599,17 @@ class WskActivation()
      * @param activationId the activation id
      * @param expectedExitCode (optional) the expected exit code for the 
command
      * if the code is anything but DONTCARE_EXIT, assert the code is as 
expected
+     * @param last retrieves latest acitvation
      */
     def result(
-        activationId: String,
-        expectedExitCode: Int = SUCCESS_EXIT)(
+        activationId: Option[String] = None,
+        expectedExitCode: Int = SUCCESS_EXIT,
+        last: Option[Boolean] = None)(
             implicit wp: WskProps): RunResult = {
-        cli(wp.overrides ++ Seq(noun, "result", activationId, "--auth", 
wp.authKey), expectedExitCode)
+        val params =
+          { activationId map { a => Seq(a) } getOrElse Seq() } ++
+          { last map { l => Seq("--last") } getOrElse Seq() }
+        cli(wp.overrides ++ Seq(noun, "result", "--auth", wp.authKey) ++ 
params, expectedExitCode)
     }
 
     /**
diff --git a/tests/src/test/scala/common/WskTestHelpers.scala 
b/tests/src/test/scala/common/WskTestHelpers.scala
index f83b1ee..7f3d750 100644
--- a/tests/src/test/scala/common/WskTestHelpers.scala
+++ b/tests/src/test/scala/common/WskTestHelpers.scala
@@ -214,7 +214,7 @@ trait WskTestHelpers extends Matchers {
         }
 
         val parsed = activationIds.map { id =>
-            wsk.parseJsonString(wsk.get(id).stdout).convertTo[CliActivation]
+            
wsk.parseJsonString(wsk.get(Some(id)).stdout).convertTo[CliActivation]
         }
         try {
             check(parsed)
diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala 
b/tests/src/test/scala/system/basic/WskBasicTests.scala
index b492c2c..4090348 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -852,34 +852,84 @@ class WskBasicTests
             withActivation(wsk.activation, run) {
                 activation =>
                     val successMsg = s"ok: got activation 
${activation.activationId}, displaying field"
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("namespace")).stdout should include regex (s"""(?i)$successMsg 
namespace\n$ns_regex_list""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("name")).stdout should include(s"""$successMsg name\n"$name"""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("version")).stdout should include(s"""$successMsg version\n"0.0.1"""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("publish")).stdout should include(s"""$successMsg publish\nfalse""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("subject")).stdout should include regex (s"""(?i)$successMsg subject\n""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("activationid")).stdout should include(s"""$successMsg 
activationid\n"${activation.activationId}""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("start")).stdout should include regex (s"""$successMsg start\n\\d""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("end")).stdout should include regex (s"""$successMsg end\n\\d""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("duration")).stdout should include regex (s"""$successMsg duration\n\\d""")
-                    wsk.activation.get(activation.activationId, fieldFilter = 
Some("annotations")).stdout should include(s"""$successMsg annotations\n[]""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("namespace")).stdout should include regex 
(s"""(?i)$successMsg namespace\n$ns_regex_list""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("name")).stdout should include(s"""$successMsg 
name\n"$name"""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("version")).stdout should include(s"""$successMsg 
version\n"0.0.1"""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("publish")).stdout should include(s"""$successMsg 
publish\nfalse""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("subject")).stdout should include regex (s"""(?i)$successMsg 
subject\n""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("activationid")).stdout should include(s"""$successMsg 
activationid\n"${activation.activationId}""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("start")).stdout should include regex (s"""$successMsg 
start\n\\d""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("end")).stdout should include regex (s"""$successMsg 
end\n\\d""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("duration")).stdout should include regex (s"""$successMsg 
duration\n\\d""")
+                    wsk.activation.get(Some(activation.activationId), 
fieldFilter = Some("annotations")).stdout should include(s"""$successMsg 
annotations\n[]""")
             }
     }
 
     it should "reject get of activation that does not exist" in {
         val name = "0"*32
-        val stderr = wsk.activation.get(name, expectedExitCode = 
NOT_FOUND).stderr
+        val stderr = wsk.activation.get(Some(name), expectedExitCode = 
NOT_FOUND).stderr
         stderr should include regex (s"""Unable to get activation '$name': The 
requested resource does not exist. \\(code \\d+\\)""")
     }
 
     it should "reject logs of activation that does not exist" in {
         val name = "0"*32
-        val stderr = wsk.activation.logs(name, expectedExitCode = 
NOT_FOUND).stderr
+        val stderr = wsk.activation.logs(Some(name), expectedExitCode = 
NOT_FOUND).stderr
         stderr should include regex (s"""Unable to get logs for activation 
'$name': The requested resource does not exist. \\(code \\d+\\)""")
     }
 
     it should "reject result of activation that does not exist" in {
         val name = "0"*32
-        val stderr = wsk.activation.result(name, expectedExitCode = 
NOT_FOUND).stderr
+        val stderr = wsk.activation.result(Some(name), expectedExitCode = 
NOT_FOUND).stderr
         stderr should include regex (s"""Unable to get result for activation 
'$name': The requested resource does not exist. \\(code \\d+\\)""")
     }
+
+    it should "retrieve the last activation using --last flag" in 
withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val auth: Seq[String] = Seq("--auth", wskprops.authKey)
+            val includeStr = "hello, undefined!"
+
+            assetHelper.withCleaner(wsk.action, "lastName") {
+                (action, _) => wsk.action.create("lastName", defaultAction)
+            }
+            val lastInvoke = wsk.action.invoke("lastName")
+            val includeID = wsk.activation.extractActivationId(lastInvoke).get
+            Thread.sleep(1000)
+
+            var  lastFlag = Seq (
+                (Seq("activation", "get", "publish", "--last"), includeID),
+                (Seq("activation", "get", "--last"), includeID),
+                (Seq("activation", "logs", "--last"), includeStr),
+                (Seq("activation", "result", "--last"), includeStr))
+
+            lastFlag foreach {
+                case (cmd, output) =>
+                    val stdout = wsk.cli(cmd ++ wskprops.overrides ++ auth, 
expectedExitCode = SUCCESS_EXIT).stdout
+                    stdout should include(output)
+            }
+    }
+
+    it should "reject activation request when using activation ID with --last 
Flag" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val auth: Seq[String] = Seq("--auth", wskprops.authKey)
+
+             assetHelper.withCleaner(wsk.action, "lastName") {
+                 (action, _) => wsk.action.create("lastName", defaultAction)
+             }
+            val lastId = 
wsk.activation.extractActivationId(wsk.action.invoke("lastName")).get
+            val tooManyArgsMsg = s"${lastId}. An activation ID is required."
+            val invalidField = s"Invalid field filter '${lastId}'."
+            Thread.sleep(1000)
+
+            var  invalidCmd = Seq (
+                (Seq("activation", "get", s"$lastId", "publish", "--last"), 
tooManyArgsMsg),
+                (Seq("activation", "get", s"$lastId", "--last"), invalidField),
+                (Seq("activation", "logs", s"$lastId", "--last"), 
tooManyArgsMsg),
+                (Seq("activation", "result", s"$lastId", "--last"), 
tooManyArgsMsg))
+
+            invalidCmd foreach {
+                case (cmd, err) =>
+                    val stderr = wsk.cli(cmd ++ wskprops.overrides ++ auth, 
expectedExitCode = ERROR_EXIT).stderr
+                    stderr should include(err)
+            }
+     }
 }
diff --git a/tests/src/test/scala/system/basic/WskSequenceTests.scala 
b/tests/src/test/scala/system/basic/WskSequenceTests.scala
index 0afc722..726c897 100644
--- a/tests/src/test/scala/system/basic/WskSequenceTests.scala
+++ b/tests/src/test/scala/system/basic/WskSequenceTests.scala
@@ -216,7 +216,7 @@ class WskSequenceTests
                     result.fields.get("error") shouldBe 
Some(JsString(sequenceIsTooLong))
                     // check that inner sequence had only (limit - 1) 
activations
                     val innerSeq = activation.logs.get(1) // the id of the 
inner sequence activation
-                    val getInnerSeq = wsk.activation.get(innerSeq)
+                    val getInnerSeq = wsk.activation.get(Some(innerSeq))
                     withActivation(wsk.activation, getInnerSeq, totalWait = 
allowedActionDuration) {
                         innerSeqActivation =>
                             innerSeqActivation.logs.get.size shouldBe (limit - 
1)
@@ -510,7 +510,7 @@ class WskSequenceTests
         withActivation(wsk.activation, run, totalWait = 2 * 
allowedActionDuration) { activation =>
             checkSequenceLogsAndAnnotations(activation, 1)
             val componentId = activation.logs.get(atomicActionIdx)
-            val getComponentActivation = wsk.activation.get(componentId)
+            val getComponentActivation = wsk.activation.get(Some(componentId))
             withActivation(wsk.activation, getComponentActivation, totalWait = 
allowedActionDuration) { componentActivation =>
                 println(componentActivation)
                 componentActivation.logs shouldBe defined
diff --git a/tools/cli/go-whisk-cli/commands/activation.go 
b/tools/cli/go-whisk-cli/commands/activation.go
index 36420f2..3176179 100644
--- a/tools/cli/go-whisk-cli/commands/activation.go
+++ b/tools/cli/go-whisk-cli/commands/activation.go
@@ -101,14 +101,22 @@ var activationListCmd = &cobra.Command{
 }
 
 var activationGetCmd = &cobra.Command{
-    Use:   "get ACTIVATION_ID [FIELD_FILTER]",
+    Use:   "get (ACTIVATION_ID | --last) [FIELD_FILTER]",
     Short: wski18n.T("get activation"),
     SilenceUsage:   true,
     SilenceErrors:  true,
     PreRunE: setupClientConfig,
     RunE: func(cmd *cobra.Command, args []string) error {
         var field string
+        var err error
 
+        if args, err = lastFlag(args); err != nil {  // Checks if any errors 
occured in lastFlag(args)
+          whisk.Debug(whisk.DbgError, "lastFlag(%#v) failed: %s\n", args, err)
+          errStr := wski18n.T("Unable to get activation: {{.err}}",
+            map[string]interface{}{"err": err})
+          werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, 
whisk.EXITCODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
+          return werr
+        }
         if whiskErr := checkArgs(args, 1, 2, "Activation get",
                 wski18n.T("An activation ID is required.")); whiskErr != nil {
             return whiskErr
@@ -164,13 +172,21 @@ var activationGetCmd = &cobra.Command{
 }
 
 var activationLogsCmd = &cobra.Command{
-    Use:   "logs ACTIVATION_ID",
+    Use:   "logs (ACTIVATION_ID | --last)",
     Short: wski18n.T("get the logs of an activation"),
     SilenceUsage:   true,
     SilenceErrors:  true,
     PreRunE: setupClientConfig,
     RunE: func(cmd *cobra.Command, args []string) error {
+        var err error
 
+        if args, err = lastFlag(args); err != nil {  // Checks if any errors 
occured in lastFlag(args)
+          whisk.Debug(whisk.DbgError, "lastFlag(%#v) failed: %s\n", args, err)
+          errStr := wski18n.T("Unable to get logs for activation: {{.err}}",
+            map[string]interface{}{"err": err})
+          werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, 
whisk.EXITCODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
+          return werr
+        }
         if whiskErr := checkArgs(args, 1, 1, "Activation logs",
                 wski18n.T("An activation ID is required.")); whiskErr != nil {
             return whiskErr
@@ -192,13 +208,21 @@ var activationLogsCmd = &cobra.Command{
 }
 
 var activationResultCmd = &cobra.Command{
-    Use:   "result ACTIVATION_ID",
+    Use:   "result (ACTIVATION_ID | --last)",
     Short: "get the result of an activation",
     SilenceUsage:   true,
     SilenceErrors:  true,
     PreRunE: setupClientConfig,
     RunE: func(cmd *cobra.Command, args []string) error {
+        var err error
 
+        if args, err = lastFlag(args); err != nil {  // Checks if any errors 
occured in lastFlag(args)
+          whisk.Debug(whisk.DbgError, "lastFlag(%#v) failed: %s\n", args, err)
+          errStr := wski18n.T("Unable to get result for activation: {{.err}}",
+            map[string]interface{}{"err": err})
+          werr := whisk.MakeWskErrorFromWskError(errors.New(errStr), err, 
whisk.EXITCODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE)
+          return werr
+        }
         if whiskErr := checkArgs(args, 1, 1, "Activation result",
                 wski18n.T("An activation ID is required.")); whiskErr != nil {
             return whiskErr
@@ -219,6 +243,39 @@ var activationResultCmd = &cobra.Command{
     },
 }
 
+// lastFlag(args) retrieves the last activation with flag -l or --last
+// Param: Brings in []strings from args
+// Return: Returns a []string with the latest ID or the original args and any 
errors
+func lastFlag(args []string) ([]string, error) {
+    if flags.activation.last {
+        options := &whisk.ActivationListOptions {
+            Limit: 1,
+            Skip: 0,
+        }
+        activations,_, err := client.Activations.List(options)
+        if err != nil {    // Checks Activations.List for errors when 
retrieving latest activaiton
+            whisk.Debug(whisk.DbgError, "client.Activations.List(%#v) error 
during lastFlag: %s\n", options, err)
+            return args, err
+        }
+        if len(activations) == 0 {    // Checks to to see if there are 
activations available
+            whisk.Debug(whisk.DbgError, "No activations found in activation 
list\n")
+            errStr := wski18n.T("Activation list does not contain any 
activations.")
+            whiskErr := whisk.MakeWskError(errors.New(errStr), 
whisk.EXITCODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE)
+            return args, whiskErr
+        }
+        if len(args) == 0 {
+            whisk.Debug(whisk.DbgInfo, "Appending most recent activation 
ID(%s) into args\n", activations[0].ActivationID)
+            args = append(args, activations[0].ActivationID)
+        } else {
+                whisk.Debug(whisk.DbgInfo, "Appending most recent activation 
ID(%s) into args\n", activations[0].ActivationID)
+                args = append(args, activations[0].ActivationID)
+                whisk.Debug(whisk.DbgInfo, "Allocating appended ID to correct 
position in args\n")
+                args[0], args[len(args) - 1] = args[len(args) - 1], args[0]    
// IDs should be located at args[0], if 1 or more arguments are given ID has to 
be moved to args[0]
+        }
+    }
+    return args, nil
+}
+
 var activationPollCmd = &cobra.Command{
     Use:   "poll [ NAMESPACE | ACTION_NAME ]",
     Short: wski18n.T("poll continuously for log messages from currently 
running actions"),
@@ -341,6 +398,11 @@ func init() {
     activationListCmd.Flags().Int64Var(&flags.activation.since, "since", 0, 
wski18n.T("return activations with timestamps later than `SINCE`; measured in 
milliseconds since Th, 01, Jan 1970"))
 
     activationGetCmd.Flags().BoolVarP(&flags.common.summary, "summary", "s", 
false, wski18n.T("summarize activation details"))
+    activationGetCmd.Flags().BoolVarP(&flags.activation.last, "last", "l", 
false, wski18n.T("retrieves the last activation"))
+
+    activationLogsCmd.Flags().BoolVarP(&flags.activation.last, "last", "l", 
false, wski18n.T("retrieves the last activation"))
+
+    activationResultCmd.Flags().BoolVarP(&flags.activation.last, "last", "l", 
false, wski18n.T("retrieves the last activation"))
 
     activationPollCmd.Flags().IntVarP(&flags.activation.exit, "exit", "e", 0, 
wski18n.T("stop polling after `SECONDS` seconds"))
     activationPollCmd.Flags().IntVar(&flags.activation.sinceSeconds, 
"since-seconds", 0, wski18n.T("start polling for activations `SECONDS` seconds 
ago"))
diff --git a/tools/cli/go-whisk-cli/commands/flags.go 
b/tools/cli/go-whisk-cli/commands/flags.go
index dd0645b..a4fc3c0 100644
--- a/tools/cli/go-whisk-cli/commands/flags.go
+++ b/tools/cli/go-whisk-cli/commands/flags.go
@@ -88,6 +88,7 @@ type Flags struct {
         sinceHours      int
         sinceDays       int
         exit            int
+        last            bool
     }
 
     // rule
diff --git a/tools/cli/go-whisk-cli/wski18n/resources/en_US.all.json 
b/tools/cli/go-whisk-cli/wski18n/resources/en_US.all.json
index bcc776d..535f958 100644
--- a/tools/cli/go-whisk-cli/wski18n/resources/en_US.all.json
+++ b/tools/cli/go-whisk-cli/wski18n/resources/en_US.all.json
@@ -948,6 +948,10 @@
     "translation": "get activation"
   },
   {
+    "id": "Unable to get activation: {{.err}}",
+    "translation": "Unable to get activation: {{.err}}"
+  },
+  {
     "id": "Unable to get activation '{{.id}}': {{.err}}",
     "translation": "Unable to get activation '{{.id}}': {{.err}}"
   },
@@ -964,10 +968,18 @@
     "translation": "get the logs of an activation"
   },
   {
+    "id": "Unable to get logs for activation: {{.err}}",
+    "translation": "Unable to get logs for activation: {{.err}}"
+  },
+  {
     "id": "Unable to get logs for activation '{{.id}}': {{.err}}",
     "translation": "Unable to get logs for activation '{{.id}}': {{.err}}"
   },
   {
+    "id": "Unable to get result for activation: {{.err}}",
+    "translation": "Unable to get result for activation: {{.err}}"
+  },
+  {
     "id": "Unable to get result for activation '{{.id}}': {{.err}}",
     "translation": "Unable to get result for activation '{{.id}}': {{.err}}"
   },
@@ -992,6 +1004,10 @@
     "translation": "\nActivation: {{.name}} ({{.id}})\n"
   },
   {
+    "id": "Activation list does not contain any activations.",
+    "translation": "Activation list does not contain any activations."
+  },
+  {
     "id": "exclude the first `SKIP` number of activations from the result",
     "translation": "exclude the first `SKIP` number of activations from the 
result"
   },
@@ -1016,6 +1032,10 @@
     "translation": "summarize activation details"
   },
   {
+    "id": "retrieves the last activation",
+    "translation": "retrieves the last activation"
+  },
+  {
     "id": "stop polling after `SECONDS` seconds",
     "translation": "stop polling after `SECONDS` seconds"
   },
diff --git a/tools/cli/go-whisk/whisk/activation.go 
b/tools/cli/go-whisk/whisk/activation.go
index 5071341..b482d91 100644
--- a/tools/cli/go-whisk/whisk/activation.go
+++ b/tools/cli/go-whisk/whisk/activation.go
@@ -43,7 +43,6 @@ type Activation struct {
     Logs            []string    `json:"logs"`
     Annotations     KeyValueArr `json:"annotations"`
     Publish         *bool       `json:"publish,omitempty"`
-
 }
 
 type Response struct {

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to