Skip to content

Commit c4c4f21

Browse files
feature: add properties flag for commandIndex rebuild
1 parent 917cb5c commit c4c4f21

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ def _update_command_table_from_modules(args, command_modules=None):
239239
command_modules.extend(ALWAYS_LOADED_MODULES)
240240
else:
241241
# Perform module discovery
242+
from azure.cli.core import telemetry
243+
telemetry.set_command_index_rebuild_triggered(True)
242244
command_modules = []
243245
try:
244246
mods_ns_pkg = import_module('azure.cli.command_modules')

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(self, correlation_id=None, application=None):
5252
self.extension_management_detail = None
5353
self.raw_command = None
5454
self.command_preserve_casing = None
55+
self.cmd_idx_rebuild_triggered = False
5556
self.show_survey_message = False
5657
self.region_input = None
5758
self.region_identified = None
@@ -209,6 +210,7 @@ def _get_azure_cli_properties(self):
209210
set_custom_properties(result, 'OutputType', self.output_type)
210211
set_custom_properties(result, 'RawCommand', self.raw_command)
211212
set_custom_properties(result, 'CommandPreserveCasing', self.command_preserve_casing or '')
213+
set_custom_properties(result, 'CmdIdxRebuildTriggered', self.cmd_idx_rebuild_triggered)
212214
set_custom_properties(result, 'Params', ','.join(self.parameters or []))
213215
set_custom_properties(result, 'PythonVersion', platform.python_version())
214216
set_custom_properties(result, 'ModuleCorrelation', self.module_correlation)
@@ -437,6 +439,9 @@ def set_extension_management_detail(ext_name, ext_version):
437439
content = '{}@{}'.format(ext_name, ext_version)
438440
_session.extension_management_detail = content[:512]
439441

442+
@decorators.suppress_all_exceptions()
443+
def set_command_index_rebuild_triggered(cmd_idx_rebuild_triggered=False):
444+
_session.cmd_idx_rebuild_triggered = cmd_idx_rebuild_triggered
440445

441446
@decorators.suppress_all_exceptions()
442447
def set_command_details(command, output_type=None, parameters=None, extension_name=None, extension_version=None, command_preserve_casing=None):

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ def roughly_parse_command(args):
12801280
break
12811281
return ' '.join(nouns).lower()
12821282

1283+
# @TODO: add unit test
12831284
def roughly_parse_command_with_casing(args):
12841285
# Roughly parse the command part: <az VM create> --name vm1
12851286
# Similar to knack.invocation.CommandInvoker._rudimentary_get_command, but preserves original casing

0 commit comments

Comments
 (0)