@@ -79,6 +79,18 @@ def info_main(*args):
7979 logger .info ('' .join ([Style .BRIGHT , Fore .GREEN ] + list (args ) +
8080 [Style .RESET_ALL , Fore .RESET ]))
8181
82+ def pretty_log_dists (dists ):
83+ infos = []
84+ for dist in dists :
85+ infos .append ('{Fore.GREEN}{Style.BRIGHT}{name}{Style.RESET_ALL}: '
86+ 'includes recipes ({Fore.GREEN}{recipes}'
87+ '{Style.RESET_ALL})' .format (
88+ name = dist .name , recipes = ', ' .join (dist .recipes ),
89+ Fore = Fore , Style = Style ))
90+
91+ for line in infos :
92+ info ('\t ' + line )
93+
8294def shprint (command , * args , ** kwargs ):
8395 '''Runs the command (which should be an sh.Command instance), while
8496 logging the output.'''
@@ -898,10 +910,9 @@ def get_distribution(cls, ctx, name=None, recipes=[], allow_download=True,
898910 if possible_dists :
899911 info ('Of the existing distributions, the following meet '
900912 'the given requirements:' )
901- for dist in possible_dists :
902- info ('\t name {}: recipes ({})' .format (dist .name , ', ' .join (dist .recipes )))
913+ pretty_log_dists (possible_dists )
903914 else :
904- info ('No existsing dists meet the given requirements!' )
915+ info ('{} No existing dists meet the given requirements!{}' . format ( Fore . RED , Fore . RESET ) )
905916
906917
907918 # If any dist has perfect recipes, return it
@@ -2397,18 +2408,10 @@ def distributions(self, args):
23972408 ctx = Context ()
23982409 dists = Distribution .get_distributions (ctx )
23992410
2400- infos = []
2401- for dist in dists :
2402- infos .append ('{Fore.GREEN}{Style.BRIGHT}{name}{Style.RESET_ALL}: '
2403- 'includes recipes ({Fore.GREEN}{recipes}'
2404- '{Style.RESET_ALL})' .format (
2405- name = dist .name , recipes = ', ' .join (dist .recipes ),
2406- Fore = Fore , Style = Style ))
2407-
2408- print ('{Style.BRIGHT}Distributions stored internally are:'
2409- '{Style.RESET_ALL}' .format (Style = Style , Fore = Fore ))
2410- for line in infos :
2411- print ('\t ' + line )
2411+ info ('{Style.BRIGHT}Distributions currently installed are:'
2412+ '{Style.RESET_ALL}' .format (Style = Style , Fore = Fore ))
2413+
2414+ pretty_log_dists (dists )
24122415
24132416 def delete_dist (self , args ):
24142417 dist = self ._dist
0 commit comments