77import argparse
88
99from azure .cli .core .commands import ExtensionCommandSource
10- from azure .cli .core .commands .constants import SURVEY_PROMPT
10+ from azure .cli .core .commands .constants import SURVEY_PROMPT , SURVEY_PROMPT_COLOR
1111
1212from knack .help import (HelpFile as KnackHelpFile , CommandHelpFile as KnackCommandHelpFile ,
1313 GroupHelpFile as KnackGroupHelpFile , ArgumentGroupRegistry as KnackArgumentGroupRegistry ,
@@ -64,6 +64,7 @@ def _print_header(self, cli_name, help_file):
6464 def _print_detailed_help (self , cli_name , help_file ):
6565 CLIPrintMixin ._print_extensions_msg (help_file )
6666 super (CLIPrintMixin , self )._print_detailed_help (cli_name , help_file )
67+ self ._print_az_find_message (help_file .command , self .cli_ctx .enable_color )
6768
6869 @staticmethod
6970 def _get_choices_defaults_sources_str (p ):
@@ -75,7 +76,6 @@ def _get_choices_defaults_sources_str(p):
7576
7677 @staticmethod
7778 def _print_examples (help_file ):
78- from colorama import Style
7979 indent = 0
8080 _print_indent ('Examples' , indent )
8181 for e in help_file .examples :
@@ -86,9 +86,15 @@ def _print_examples(help_file):
8686 _print_indent (u'{0}' .format (e .long_summary ), indent )
8787 _print_indent (u'{0}' .format (e .command ), indent )
8888 print ('' )
89+
90+ @staticmethod
91+ def _print_az_find_message (command , enable_color ):
92+ from colorama import Style
8993 indent = 0
90- message = 'For more specific examples, use: az find "az {}"' .format (help_file .command )
91- _print_indent (Style .BRIGHT + message + Style .RESET_ALL + '\n ' , indent )
94+ message = 'For more specific examples, use: az find "az {}"' .format (command )
95+ if enable_color :
96+ message = Style .BRIGHT + message + Style .RESET_ALL
97+ _print_indent (message + '\n ' , indent )
9298
9399 @staticmethod
94100 def _process_value_sources (p ):
@@ -150,8 +156,6 @@ def new_normalize_text(s):
150156 def show_help (self , cli_name , nouns , parser , is_group ):
151157 self .update_loaders_with_help_file_contents (nouns )
152158
153- import colorama
154- colorama .init (autoreset = True )
155159 delimiters = ' ' .join (nouns )
156160 help_file = self .command_help_cls (self , delimiters , parser ) if not is_group \
157161 else self .group_help_cls (self , delimiters , parser )
@@ -162,7 +166,8 @@ def show_help(self, cli_name, nouns, parser, is_group):
162166 AzCliHelp .update_examples (help_file )
163167 self ._print_detailed_help (cli_name , help_file )
164168
165- print (SURVEY_PROMPT )
169+ from colorama import Fore , Style
170+ print (SURVEY_PROMPT_COLOR if self .cli_ctx .enable_color else SURVEY_PROMPT )
166171
167172 def _register_help_loaders (self ):
168173 import azure .cli .core ._help_loaders as help_loaders
0 commit comments