Skip to content

Commit 070db4e

Browse files
committed
Fix logic in command detection
1 parent 1e78aeb commit 070db4e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/goldfinch/utils/click2cwl_cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def resolve_cli_command(
118118
"-c", "--command",
119119
metavar="COMMAND",
120120
default=None,
121-
type=click.Path(exists=True, dir_okay=False),
122121
help="If the python script defines multiple commands, this can be used to specify which one to convert.",
123122
)
124123
@click.option(
@@ -220,12 +219,13 @@ def main(ctx: click.Context, **kwargs: str) -> None:
220219
cli_spec.loader.exec_module(cli_mod)
221220

222221
# find the decorated Click function to convert
223-
click_functions = [
224-
(name, member)
225-
for name, member in
226-
inspect.getmembers(cli_mod)
227-
if (not name.startswith("_") or kwargs["command"] == name) and isinstance(member, click.Command)
228-
]
222+
click_functions = []
223+
for name, member in inspect.getmembers(cli_mod):
224+
if isinstance(member, click.Command) and not name.startswith("_"):
225+
if kwargs["command"] and kwargs["command"] != name:
226+
continue
227+
click_functions.append((name, member))
228+
229229
if len(click_functions) != 1:
230230
names = [name for name, _ in click_functions]
231231
raise ValueError(

0 commit comments

Comments
 (0)