|
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. |
@@ -433,7 +435,7 @@ def _get_extension_suppressions(mod_loaders): |
433 | 435 | if index_result: |
434 | 436 | index_modules, index_extensions = index_result |
435 | 437 | # Special case for top-level completion - create minimal command groups |
436 | | - if index_modules == '__top_level_completion__': |
| 438 | + if index_modules == TOP_LEVEL_COMPLETION_MARKER: |
437 | 439 | from azure.cli.core.commands import AzCliCommand |
438 | 440 | # index_extensions contains the command names, not extensions |
439 | 441 | for cmd_name in index_extensions: |
@@ -617,7 +619,7 @@ def get(self, args): |
617 | 619 | index = self.INDEX[self._COMMAND_INDEX] |
618 | 620 | all_commands = list(index.keys()) |
619 | 621 | logger.debug("Top-level completion: %d commands available", len(all_commands)) |
620 | | - return '__top_level_completion__', all_commands # special marker, command list |
| 622 | + return TOP_LEVEL_COMPLETION_MARKER, all_commands # special marker, command list |
621 | 623 | return None |
622 | 624 |
|
623 | 625 | # Get the top-level command, like `network` in `network vnet create -h` |
|
0 commit comments