Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change expectations for entry point so it returns the names of transl…
Browse files Browse the repository at this point in the history
…ators
timj committed Jan 7, 2025
1 parent 7f3fe9d commit 7ea8687
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions python/astro_metadata_translator/cli/astrometadata.py
Original file line number Diff line number Diff line change
@@ -98,9 +98,17 @@ def main(
plugins = {p.name: p for p in entry_points(group="astro_metadata_translators")}
if list_plugins:
if plugins:
print("Available translator plugins:")
for k in sorted(plugins):
print("* ", k)
print("Available translator plugins grouped by label (use '-p <label>' to activate):")

Check warning on line 101 in python/astro_metadata_translator/cli/astrometadata.py

Codecov / codecov/patch

python/astro_metadata_translator/cli/astrometadata.py#L101

Added line #L101 was not covered by tests
for label in sorted(plugins):
print(f"* {label}:")
try:
func = plugins[label].load()
except Exception as e:
print(f" - Unable to load plugin [{e}]")
continue
translators = func()

Check warning on line 109 in python/astro_metadata_translator/cli/astrometadata.py

Codecov / codecov/patch

python/astro_metadata_translator/cli/astrometadata.py#L103-L109

Added lines #L103 - L109 were not covered by tests
for t in translators:
print(f" - {t}")
return

Check warning on line 112 in python/astro_metadata_translator/cli/astrometadata.py

Codecov / codecov/patch

python/astro_metadata_translator/cli/astrometadata.py#L111-L112

Added lines #L111 - L112 were not covered by tests

packages_set = set(packages)

0 comments on commit 7ea8687

Please sign in to comment.