|
26 | 26 | EXCLUDED_PARAMS = ['self', 'raw', 'polling', 'custom_headers', 'operation_config', |
27 | 27 | 'content_version', 'kwargs', 'client', 'no_wait'] |
28 | 28 | EVENT_FAILED_EXTENSION_LOAD = 'MainLoader.OnFailedExtensionLoad' |
| 29 | +# Marker used by CommandIndex.get() to signal top-level tab completion optimization |
| 30 | +TOP_LEVEL_COMPLETION_MARKER = '__top_level_completion__' |
29 | 31 |
|
30 | 32 | # [Reserved, in case of future usage] |
31 | 33 | # Modules that will always be loaded. They don't expose commands but hook into CLI core. |
@@ -435,7 +437,7 @@ def _get_extension_suppressions(mod_loaders): |
435 | 437 | if index_result: |
436 | 438 | index_modules, index_extensions = index_result |
437 | 439 | # Special case for top-level completion - create minimal command groups |
438 | | - if index_modules == '__top_level_completion__': |
| 440 | + if index_modules == TOP_LEVEL_COMPLETION_MARKER: |
439 | 441 | from azure.cli.core.commands import AzCliCommand |
440 | 442 | # index_extensions contains the command names, not extensions |
441 | 443 | for cmd_name in index_extensions: |
@@ -619,7 +621,7 @@ def get(self, args): |
619 | 621 | index = self.INDEX[self._COMMAND_INDEX] |
620 | 622 | all_commands = list(index.keys()) |
621 | 623 | logger.debug("Top-level completion: %d commands available", len(all_commands)) |
622 | | - return '__top_level_completion__', all_commands # special marker, command list |
| 624 | + return TOP_LEVEL_COMPLETION_MARKER, all_commands # special marker, command list |
623 | 625 | return None |
624 | 626 |
|
625 | 627 | # Get the top-level command, like `network` in `network vnet create -h` |
|
0 commit comments