Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
3275:55eeb0dfd313 | 3276:81c8910db91f |
---|---|
31 __commands__ = ["Event"] | 31 __commands__ = ["Event"] |
32 | 32 |
33 OUTPUT_OPT_TABLE = "table" | 33 OUTPUT_OPT_TABLE = "table" |
34 | 34 |
35 # TODO: move date parsing to base, it may be useful for other commands | 35 # TODO: move date parsing to base, it may be useful for other commands |
36 | |
37 | |
38 class List(base.CommandBase): | |
39 def __init__(self, host): | |
40 base.CommandBase.__init__( | |
41 self, | |
42 host, | |
43 "list", | |
44 use_output=C.OUTPUT_LIST_DICT, | |
45 use_pubsub=True, | |
46 use_verbose=True, | |
47 help=_("get list of registered events"), | |
48 ) | |
49 | |
50 def add_parser_options(self): | |
51 pass | |
52 | |
53 async def start(self): | |
54 try: | |
55 events = await self.host.bridge.eventsList( | |
56 self.args.service, | |
57 self.args.node, | |
58 self.profile, | |
59 ) | |
60 except Exception as e: | |
61 self.disp(f"can't get list of events: {e}", error=True) | |
62 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
63 else: | |
64 await self.output(events) | |
65 self.host.quit() | |
36 | 66 |
37 | 67 |
38 class Get(base.CommandBase): | 68 class Get(base.CommandBase): |
39 def __init__(self, host): | 69 def __init__(self, host): |
40 base.CommandBase.__init__( | 70 base.CommandBase.__init__( |
542 host, "invitee", use_profile=False, help=_("manage invities") | 572 host, "invitee", use_profile=False, help=_("manage invities") |
543 ) | 573 ) |
544 | 574 |
545 | 575 |
546 class Event(base.CommandBase): | 576 class Event(base.CommandBase): |
547 subcommands = (Get, Create, Modify, Invitee) | 577 subcommands = (List, Get, Create, Modify, Invitee) |
548 | 578 |
549 def __init__(self, host): | 579 def __init__(self, host): |
550 super(Event, self).__init__( | 580 super(Event, self).__init__( |
551 host, "event", use_profile=False, help=_("event management") | 581 host, "event", use_profile=False, help=_("event management") |
552 ) | 582 ) |