changeset 2600:947c4c4c5c53

jp (info/session): by default, display started as human readable date instead of Unix time
author Goffi <goffi@goffi.org>
date Fri, 01 Jun 2018 12:06:33 +0200
parents 5b26033c49a8
children 12bf089f0bf3
files sat_frontends/jp/cmd_info.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_info.py	Fri Jun 01 12:04:06 2018 +0200
+++ b/sat_frontends/jp/cmd_info.py	Fri Jun 01 12:06:33 2018 +0200
@@ -20,6 +20,7 @@
 import base
 from sat.core.i18n import _
 from sat.tools.common.ansi import ANSI as A
+from sat.tools.common import date_utils
 from sat_frontends.jp.constants import Const as C
 from sat_frontends.jp import common
 
@@ -168,9 +169,15 @@
 class Session(base.CommandBase):
 
     def __init__(self, host):
-        super(Session, self).__init__(host, 'session', use_output='dict', help=_('running session'))
+        extra_outputs = {'default': self.default_output}
+        super(Session, self).__init__(host, 'session', use_output='dict', extra_outputs=extra_outputs, help=_('running session'))
         self.need_loop=True
 
+    def default_output(self, data):
+        started = data['started']
+        data['started'] = date_utils.date_fmt(started)
+        self.host.output(C.OUTPUT_DICT, 'simple', {}, data)
+
     def add_parser_options(self):
         pass