# HG changeset patch # User Goffi # Date 1583515143 -3600 # Node ID a10e12dfbda8b989c971b2d0bdb822b332109c48 # Parent ae09989e9febf644a7b7cdf8c86a344aba946ee8 jp(info): `devices` command first draft: this command gather data on known devices of an entity. diff -r ae09989e9feb -r a10e12dfbda8 CHANGELOG --- a/CHANGELOG Fri Mar 06 18:19:03 2020 +0100 +++ b/CHANGELOG Fri Mar 06 18:19:03 2020 +0100 @@ -58,6 +58,7 @@ - background colour detection - new debug/theme command - new file/get command (supports aesgcm scheme) + - new info/devices command - file/upload handle encryption - various improvments - (blog) added --language to common publish arguments diff -r ae09989e9feb -r a10e12dfbda8 sat_frontends/jp/cmd_info.py --- a/sat_frontends/jp/cmd_info.py Fri Mar 06 18:19:03 2020 +0100 +++ b/sat_frontends/jp/cmd_info.py Fri Mar 06 18:19:03 2020 +0100 @@ -20,7 +20,7 @@ from . 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.tools.common import date_utils, data_format from sat_frontends.jp.constants import Const as C from sat_frontends.jp import common @@ -225,8 +225,32 @@ self.host.quit() +class Devices(base.CommandBase): + + def __init__(self, host): + super(Devices, self).__init__( + host, 'devices', use_output=C.OUTPUT_LIST_DICT, + help=_('devices of an entity')) + + def add_parser_options(self): + self.parser.add_argument( + "jid", type=str, nargs='?', default='', help=_("Entity to request")) + + async def start(self): + try: + data = await self.host.bridge.devicesInfosGet( + self.args.jid, self.host.profile) + except Exception as e: + self.disp(_(f'Error getting devices infos: {e}'), error=True) + self.host.quit(C.EXIT_BRIDGE_ERRBACK) + else: + data = data_format.deserialise(data, type_check=list) + await self.output(data) + self.host.quit() + + class Info(base.CommandBase): - subcommands = (Disco, Version, Session) + subcommands = (Disco, Version, Session, Devices) def __init__(self, host): super(Info, self).__init__(