From 596e8c6c401bed9dd0ea26b7c22ff7239e9a3463 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 10 May 2023 10:19:26 +0200 Subject: [PATCH] Fix crash of 'swh lister run' when called without -l ``` $ swh lister run Traceback (most recent call last): File "/home/dev/.local/bin/swh", line 33, in sys.exit(load_entry_point('swh.core', 'console_scripts', 'swh')()) File "/home/dev/swh-environment/swh-core/swh/core/cli/__init__.py", line 144, in main return swh(auto_envvar_prefix="SWH") File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/dev/.local/lib/python3.9/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/home/dev/.local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/home/dev/swh-environment/swh-lister/swh/lister/cli.py", line 68, in run get_lister(lister, **config).run() File "/home/dev/swh-environment/swh-lister/swh/lister/__init__.py", line 75, in get_lister raise ValueError( ValueError: Invalid lister None: only supported listers are ['arch', 'aur', 'bitbucket', 'bower', 'cgit', 'conda', 'cpan', 'cran', 'crates', 'debian', 'fedora', 'gitea', 'github', 'gitlab', 'gnu', 'gogs', 'golang', 'hackage', 'hex', 'launchpad', 'maven', 'nixguix', 'npm', 'nuget', 'opam', 'packagist', 'phabricator', 'pubdev', 'puppet', 'pypi', 'rubygems', 'sourceforge', 'tuleap'] ``` --- swh/lister/cli.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swh/lister/cli.py b/swh/lister/cli.py index ec7655e..028e251 100644 --- a/swh/lister/cli.py +++ b/swh/lister/cli.py @@ -53,7 +53,11 @@ def lister(ctx, config_file): "defined by the user", ) @click.option( - "--lister", "-l", help="Lister to run", type=click.Choice(SUPPORTED_LISTERS) + "--lister", + "-l", + help="Lister to run", + type=click.Choice(SUPPORTED_LISTERS), + required=True, ) @click.argument("options", nargs=-1) @click.pass_context