If argcomplete is enabled, allow triggering command-line autocompletion
(self, classes: list[t.Any], subcommands: SubcommandsDict | None)
| 1124 | self.log.warning("Unrecognized alias: '%s', it will have no effect.", arg) |
| 1125 | |
| 1126 | def _argcomplete(self, classes: list[t.Any], subcommands: SubcommandsDict | None) -> None: |
| 1127 | """If argcomplete is enabled, allow triggering command-line autocompletion""" |
| 1128 | try: |
| 1129 | import argcomplete # noqa: F401 |
| 1130 | except ImportError: |
| 1131 | return |
| 1132 | |
| 1133 | from . import argcomplete_config |
| 1134 | |
| 1135 | finder = argcomplete_config.ExtendedCompletionFinder() # type:ignore[no-untyped-call] |
| 1136 | finder.config_classes = classes |
| 1137 | finder.subcommands = list(subcommands or []) |
| 1138 | # for ease of testing, pass through self._argcomplete_kwargs if set |
| 1139 | finder(self.parser, **getattr(self, "_argcomplete_kwargs", {})) |
| 1140 | |
| 1141 | |
| 1142 | class KeyValueConfigLoader(KVArgParseConfigLoader): |
nothing calls this directly
no outgoing calls
no test coverage detected