File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff 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 (
@@ -229,12 +228,13 @@ def main(ctx: click.Context, **kwargs: str) -> None:
229228 cli_spec .loader .exec_module (cli_mod )
230229
231230 # find the decorated Click function to convert
232- click_functions = [
233- (name , member )
234- for name , member in
235- inspect .getmembers (cli_mod )
236- if (not name .startswith ("_" ) or kwargs ["command" ] == name ) and isinstance (member , click .Command )
237- ]
231+ click_functions = []
232+ for name , member in inspect .getmembers (cli_mod ):
233+ if isinstance (member , click .Command ) and not name .startswith ("_" ):
234+ if kwargs ["command" ] and kwargs ["command" ] != name :
235+ continue
236+ click_functions .append ((name , member ))
237+
238238 if len (click_functions ) != 1 :
239239 names = [name for name , _ in click_functions ]
240240 raise ValueError (
You can’t perform that action at this time.
0 commit comments