Mercurial > libervia-backend
diff sat_frontends/jp/cmd_application.py @ 3377:297389b1563c
jp (application/list): don't use `extend` in argument as in it Python 3.8+ only
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 01 Oct 2020 10:12:01 +0200 |
parents | 47755614b82a |
children | be6d91572633 |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_application.py Mon Sep 28 21:10:33 2020 +0200 +++ b/sat_frontends/jp/cmd_application.py Thu Oct 01 10:12:01 2020 +0200 @@ -34,17 +34,26 @@ ) def add_parser_options(self): + # FIXME: "extend" would be better here, but it's only available from Python 3.8+ + # so we use "append" until minimum version of Python is raised. self.parser.add_argument( "-f", - "--filters", - action="extend", - nargs="+", + "--filter", + dest="filters", + action="append", choices=["available", "running"], - default=["available"], help=_("show applications with this status"), ) async def start(self): + + # FIXME: this is only needed because we can't use "extend" in + # add_parser_options, see note there + if self.args.filters: + self.args.filters = list(set(self.args.filters)) + else: + self.args.filters = ['available'] + try: found_apps = await self.host.bridge.applicationsList(self.args.filters) except Exception as e: