jp (application/list): don't use extend in argument as in it Python 3.8+ only
This commit is contained in:
parent
e91cd1cc66
commit
7b746a50a8
1 changed files with 13 additions and 4 deletions
|
|
@ -34,17 +34,26 @@ class List(base.CommandBase):
|
|||
)
|
||||
|
||||
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue