Skip to content

Commit 726da36

Browse files
fix: init string before show cached help
1 parent 52dec95 commit 726da36

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,9 +748,15 @@ def _try_show_cached_help(self, args):
748748
if not help_index and command_index.needs_latest_extension_help_overlay_refresh():
749749
logger.debug("Top-level cached help is unavailable on latest profile. "
750750
"Refreshing extension help overlay without full core module load.")
751-
# Unknown top-level command forces extension-only load path on latest profile.
752-
self.commands_loader.load_command_table(['__refresh_extension_help_overlay__'])
753-
help_index = command_index.get_help_index()
751+
try:
752+
if self.cli_ctx.invocation.data.get('command_string') is None:
753+
self.cli_ctx.invocation.data['command_string'] = ''
754+
# Unknown top-level command forces extension-only load path on latest profile.
755+
self.commands_loader.load_command_table(['__refresh_extension_help_overlay__'])
756+
help_index = command_index.get_help_index()
757+
except Exception as ex: # pylint: disable=broad-except
758+
# Keep cached-help refresh best-effort; normal invocation flow can still continue.
759+
logger.debug("Failed to refresh latest extension help overlay: %s", ex)
754760

755761
if help_index:
756762
# Display cached help using the help system

0 commit comments

Comments
 (0)