@@ -79,6 +79,18 @@ def info_main(*args):
79
79
logger .info ('' .join ([Style .BRIGHT , Fore .GREEN ] + list (args ) +
80
80
[Style .RESET_ALL , Fore .RESET ]))
81
81
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
+
82
94
def shprint (command , * args , ** kwargs ):
83
95
'''Runs the command (which should be an sh.Command instance), while
84
96
logging the output.'''
@@ -898,10 +910,9 @@ def get_distribution(cls, ctx, name=None, recipes=[], allow_download=True,
898
910
if possible_dists :
899
911
info ('Of the existing distributions, the following meet '
900
912
'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 )
903
914
else :
904
- info ('No existsing dists meet the given requirements!' )
915
+ info ('{} No existing dists meet the given requirements!{}' . format ( Fore . RED , Fore . RESET ) )
905
916
906
917
907
918
# If any dist has perfect recipes, return it
@@ -2397,18 +2408,10 @@ def distributions(self, args):
2397
2408
ctx = Context ()
2398
2409
dists = Distribution .get_distributions (ctx )
2399
2410
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 )
2412
2415
2413
2416
def delete_dist (self , args ):
2414
2417
dist = self ._dist
0 commit comments