comparison sat_frontends/jp/cmd_info.py @ 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 26edcf3a30eb
children 87f8cf51fca5
comparison
equal deleted inserted replaced
2599:5b26033c49a8 2600:947c4c4c5c53
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 import base 20 import base
21 from sat.core.i18n import _ 21 from sat.core.i18n import _
22 from sat.tools.common.ansi import ANSI as A 22 from sat.tools.common.ansi import ANSI as A
23 from sat.tools.common import date_utils
23 from sat_frontends.jp.constants import Const as C 24 from sat_frontends.jp.constants import Const as C
24 from sat_frontends.jp import common 25 from sat_frontends.jp import common
25 26
26 __commands__ = ["Info"] 27 __commands__ = ["Info"]
27 28
166 167
167 168
168 class Session(base.CommandBase): 169 class Session(base.CommandBase):
169 170
170 def __init__(self, host): 171 def __init__(self, host):
171 super(Session, self).__init__(host, 'session', use_output='dict', help=_('running session')) 172 extra_outputs = {'default': self.default_output}
173 super(Session, self).__init__(host, 'session', use_output='dict', extra_outputs=extra_outputs, help=_('running session'))
172 self.need_loop=True 174 self.need_loop=True
175
176 def default_output(self, data):
177 started = data['started']
178 data['started'] = date_utils.date_fmt(started)
179 self.host.output(C.OUTPUT_DICT, 'simple', {}, data)
173 180
174 def add_parser_options(self): 181 def add_parser_options(self):
175 pass 182 pass
176 183
177 def start(self): 184 def start(self):