unikubehq / cli

The convenient command line interface (CLI) to the unikube platform. :computer:
https://unikube.io
Apache License 2.0
18 stars 1 forks source link

`project down` shows stack trace when there's no "upped" project #329

Open tschale opened 2 years ago

tschale commented 2 years ago

Unikube v1.2.9

When running project down with no "upped" project (project up), I get following stack trace shown:

Traceback (most recent call last):
  File "/home/gutschi/.local/bin/unikube", line 8, in <module>
    sys.exit(cli())
  File "/home/gutschi/.local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/gutschi/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/gutschi/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gutschi/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/gutschi/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/gutschi/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/gutschi/.local/lib/python3.8/site-packages/click/decorators.py", line 38, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/gutschi/.local/lib/python3.8/site-packages/unikube/cli/project.py", line 298, in down
    project_id = console.project_list(
  File "/home/gutschi/.local/lib/python3.8/site-packages/unikube/cli/console/project.py", line 39, in project_list
    selection = console.list(
  File "/home/gutschi/.local/lib/python3.8/site-packages/unikube/cli/console/input.py", line 119, in list
    answer = inquirer.fuzzy(
  File "/usr/local/lib/python3.8/dist-packages/InquirerPy/prompts/fuzzy.py", line 390, in __init__
    self._content_control: InquirerPyFuzzyControl = InquirerPyFuzzyControl(
  File "/usr/local/lib/python3.8/dist-packages/InquirerPy/prompts/fuzzy.py", line 73, in __init__
    super().__init__(
  File "/usr/local/lib/python3.8/dist-packages/InquirerPy/base/control.py", line 73, in __init__
    self._safety_check()
  File "/usr/local/lib/python3.8/dist-packages/InquirerPy/base/control.py", line 156, in _safety_check
    raise InvalidArgument("argument choices cannot be empty")
InquirerPy.exceptions.InvalidArgument: argument choices cannot be empty

When there is an active project, project down shows the list-prompt. We probably should except that error and display a user friendly message.