Repository: incubator-mynewt-newt Updated Branches: refs/heads/develop f985e2c27 -> 6c7e59f90
MYNEWT-516: Add "last" command to mynewt manager newtmgr interprets the "last" command specified in place of a timestamp and passed a "-1" through the newtmgr protocol to the device. The device will interpret this timestamp to mean that the last record is requested. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/6c7e59f9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/6c7e59f9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/6c7e59f9 Branch: refs/heads/develop Commit: 6c7e59f90d98eb6852a92514c0ea071eb6b90b99 Parents: f985e2c Author: Peter Snyder <[email protected]> Authored: Tue Dec 20 16:33:19 2016 -0800 Committer: Peter Snyder <[email protected]> Committed: Tue Dec 20 16:33:19 2016 -0800 ---------------------------------------------------------------------- newtmgr/cli/logs.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/6c7e59f9/newtmgr/cli/logs.go ---------------------------------------------------------------------- diff --git a/newtmgr/cli/logs.go b/newtmgr/cli/logs.go index 978bbbf..d7ff96e 100644 --- a/newtmgr/cli/logs.go +++ b/newtmgr/cli/logs.go @@ -127,13 +127,18 @@ func logsShowCmd(cmd *cobra.Command, args []string) { nmUsage(cmd, err) } + if len(args) > 0 { req.Name = args[0] if len(args) > 1 { - req.Timestamp, err = strconv.ParseInt(args[1], 0, 64) - if len(args) > 2 { - req.Index, err = strconv.ParseUint(args[2], 0, 64) - } + if args[1] == "last" { + req.Timestamp = -1 + } else { + req.Timestamp, err = strconv.ParseInt(args[1], 0, 64) + if len(args) > 2 { + req.Index, err = strconv.ParseUint(args[2], 0, 64) + } + } } if err != nil {
