API

class click_commands_folder.CommandsFolder(path: str, name: str | None = None, exclude: list[str] | None = None, **attrs: Any)

A Group that looks up subcommands from a folder.

Parameters:
  • path – The folder path where the subcommands are stored.

  • name – The name of the group command.

  • exclude – A list of module filenames that should be ignored.

  • attrs – Other arguments passed to Group.

get_command(ctx: Context, cmd_name: str) Command | None

Load and return a command.

Parameters:
  • ctx – A Context object used when loading the commands.

  • cmd_name – The name of the desired command.

list_commands(ctx: Context) List[str]

Load and return the list of all registered commands.

Parameters:

ctx – A Context object used when loading the commands.

modules: dict[str, types.ModuleType]

The loaded Python modules containing the subcommands.