Skip to content
21 changes: 16 additions & 5 deletions src/azure-cli-core/azure/cli/core/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _print_examples(help_file):
from colorama import Style
indent = 0
_print_indent('Examples', indent)
for e in AzCliHelp.example_provider(help_file):
for e in help_file.examples:
indent = 1
_print_indent(u'{0}'.format(e.short_summary), indent)
indent = 2
Expand Down Expand Up @@ -147,10 +147,21 @@ def new_normalize_text(s):
self._register_help_loaders()
self._name_to_content = {}

# override
def show_help(self, cli_name, nouns, parser, is_group):
self.update_loaders_with_help_file_contents(nouns)
super(AzCliHelp, self).show_help(cli_name, nouns, parser, is_group)

import colorama
colorama.init(autoreset=True)
delimiters = ' '.join(nouns)
help_file = self.command_help_cls(self, delimiters, parser) if not is_group \
else self.group_help_cls(self, delimiters, parser)
help_file.load(parser)
if not nouns:
help_file.command = ''
else:
AzCliHelp.update_examples(help_file)
self._print_detailed_help(cli_name, help_file)

print(SURVEY_PROMPT)

def _register_help_loaders(self):
Expand Down Expand Up @@ -192,8 +203,8 @@ def update_loaders_with_help_file_contents(self, nouns):

# This method is meant to be a hook that can be overridden by an extension or module.
@staticmethod
def example_provider(help_file):
return help_file.examples
def update_examples(help_file):
pass


class CliHelpFile(KnackHelpFile):
Expand Down