Expected Behavior
I can refer parsed options in MultiCommand.list_commands method.
Actual Behavior
I can't. Options aren't initialized in the list_commands.
I'm creating a CLI tool that dynamically loads subcommands from a file. And the location of the file is specified by an option of the CLI tool. I can refer the parsed option in MultiCommand.get_command but I can't refer it in MultiCommand.list_commands method.
I think the list_command method is called before finishing the parse_args method so we can't use parsed options in the list_commands.
|
echo(ctx.get_help(), color=ctx.color) |
|
for subcommand in self.list_commands(ctx): |
I created the following file and I got an empty dictionary object by the logger.debug when I execute the following command.
https://github.com/polikeiji/bkm/blob/master/bkm.py#L94
python -m bkm -f AAA --help
Is this behavior the expected one?
Environment
- Python version: 3.8.0
- Click version: 7.1.2
Expected Behavior
I can refer parsed options in MultiCommand.list_commands method.
Actual Behavior
I can't. Options aren't initialized in the list_commands.
I'm creating a CLI tool that dynamically loads subcommands from a file. And the location of the file is specified by an option of the CLI tool. I can refer the parsed option in MultiCommand.get_command but I can't refer it in MultiCommand.list_commands method.
I think the list_command method is called before finishing the parse_args method so we can't use parsed options in the list_commands.
click/src/click/core.py
Line 1242 in fef921a
click/src/click/core.py
Line 1217 in fef921a
I created the following file and I got an empty dictionary object by the logger.debug when I execute the following command.
https://github.com/polikeiji/bkm/blob/master/bkm.py#L94
python -m bkm -f AAA --helpIs this behavior the expected one?
Environment