Mercurial > libervia-backend
diff sat_frontends/jp/cmd_event.py @ 3276:81c8910db91f
jp (event): new `list` command to get evens available in a service
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 18 May 2020 23:48:40 +0200 |
parents | 6cf4bd6972c2 |
children | be6d91572633 |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_event.py Mon May 18 23:43:06 2020 +0200 +++ b/sat_frontends/jp/cmd_event.py Mon May 18 23:48:40 2020 +0200 @@ -35,6 +35,36 @@ # TODO: move date parsing to base, it may be useful for other commands +class List(base.CommandBase): + def __init__(self, host): + base.CommandBase.__init__( + self, + host, + "list", + use_output=C.OUTPUT_LIST_DICT, + use_pubsub=True, + use_verbose=True, + help=_("get list of registered events"), + ) + + def add_parser_options(self): + pass + + async def start(self): + try: + events = await self.host.bridge.eventsList( + self.args.service, + self.args.node, + self.profile, + ) + except Exception as e: + self.disp(f"can't get list of events: {e}", error=True) + self.host.quit(C.EXIT_BRIDGE_ERRBACK) + else: + await self.output(events) + self.host.quit() + + class Get(base.CommandBase): def __init__(self, host): base.CommandBase.__init__( @@ -544,7 +574,7 @@ class Event(base.CommandBase): - subcommands = (Get, Create, Modify, Invitee) + subcommands = (List, Get, Create, Modify, Invitee) def __init__(self, host): super(Event, self).__init__(