Skip to content

Commit

Permalink
refactor(cli): display empty if there are no options
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Feb 22, 2025
1 parent 44537d0 commit d71eb5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions silverback/_click_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def parse_globbed_arg(selection: str, collection: dict[str, Any]) -> list[Any]:
elif matches := fnmatch.filter(collection, selection):
return [collection[match] for match in matches]

elif choices := "', '".join(collection):
raise click.BadArgumentUsage(f"Selection '{selection}' should match one of: '{choices}'")

else:
choices = "', '".join(collection)
raise click.BadArgumentUsage(f"Selection '{selection}' does not match any of: '{choices}'")
raise click.BadArgumentUsage("No choices available")


def cls_import_callback(ctx, param, cls_name):
Expand Down

0 comments on commit d71eb5a

Please sign in to comment.