Find all CommandSets that match the provided CommandSet type. By default, locates a CommandSet that is an exact type match but may optionally return all CommandSets that are sub-classes of the provided type :param commandset_type: CommandSet sub-class type to search for
(
self, commandset_type: type[CommandSet[Any]], *, subclass_match: bool = False
)
| 783 | return PromptSession(**kwargs) |
| 784 | |
| 785 | def find_commandsets( |
| 786 | self, commandset_type: type[CommandSet[Any]], *, subclass_match: bool = False |
| 787 | ) -> list[CommandSet[Any]]: |
| 788 | """Find all CommandSets that match the provided CommandSet type. |
| 789 | |
| 790 | By default, locates a CommandSet that is an exact type match but may optionally return all CommandSets that |
| 791 | are sub-classes of the provided type |
| 792 | :param commandset_type: CommandSet sub-class type to search for |
| 793 | :param subclass_match: If True, return all sub-classes of provided type, otherwise only search for exact match |
| 794 | :return: Matching CommandSets |
| 795 | """ |
| 796 | return [ |
| 797 | cmdset |
| 798 | for cmdset in self._installed_command_sets |
| 799 | if type(cmdset) == commandset_type or (subclass_match and isinstance(cmdset, commandset_type)) # noqa: E721 |
| 800 | ] |
| 801 | |
| 802 | def find_commandset_for_command(self, command_name: str) -> CommandSet[Any] | None: |
| 803 | """Find the CommandSet that registered the command name. |
no outgoing calls