Skip to content

Commit 3d68e98

Browse files
refactor: create variable for top_level_marker
1 parent c12f964 commit 3d68e98

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/azure-cli-core/azure/cli/core/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
EXCLUDED_PARAMS = ['self', 'raw', 'polling', 'custom_headers', 'operation_config',
2727
'content_version', 'kwargs', 'client', 'no_wait']
2828
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__'
2931

3032
# [Reserved, in case of future usage]
3133
# 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):
433435
if index_result:
434436
index_modules, index_extensions = index_result
435437
# 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:
437439
from azure.cli.core.commands import AzCliCommand
438440
# index_extensions contains the command names, not extensions
439441
for cmd_name in index_extensions:
@@ -617,7 +619,7 @@ def get(self, args):
617619
index = self.INDEX[self._COMMAND_INDEX]
618620
all_commands = list(index.keys())
619621
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
621623
return None
622624

623625
# Get the top-level command, like `network` in `network vnet create -h`

0 commit comments

Comments
 (0)