Changeset 188 for cleverbox/trunk

Show
Ignore:
Timestamp:
08/14/07 13:29:11 (5 years ago)
Author:
trivoallan
Message:

cleverbox : implemented more readable output for "project list"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cleverbox/trunk/cleverbox/scripts/admin.py

    r187 r188  
    1414style = dummy() 
    1515style.ERROR = termcolors.make_style(fg='red', opts=('bold',)) 
     16style.SUCCESS = termcolors.make_style(fg='green', opts=('bold',)) 
     17style.H1 = termcolors.make_style(fg='white', opts=('bold', 'underline')) 
     18style.ENABLED = termcolors.make_style(fg='green') 
     19style.DISABLED = termcolors.make_style(fg='red') 
    1620del dummy 
    1721 
     
    268272 
    269273    def _do_project_list(self, line=None): 
    270         """ 
    271         TODO : Nicer formatting 
    272         """ 
    273  
    274         print 
    275         print "Available projects :" 
    276         print "--------------------" 
    277274 
    278275        client_projects = {} 
    279276 
    280         clients = client.get() 
     277        clients = client.get(self.env) 
     278        clients.sort() 
    281279        for client_name in clients: 
    282             client_projects[client_name] = project.get(self.env, client_name) 
    283  
    284         print client_projects 
     280            print style.H1("%s :" % client_name) 
     281            enabled_projects = project.get(self.env, client_name, 'enabled') 
     282            disabled_projects = project.get(self.env, client_name, 'disabled') 
     283            
     284            if enabled_projects: 
     285                enabled_projects.sort() 
     286                print "  Enabled :" 
     287                for project_name in enabled_projects: 
     288                    print style.ENABLED("    - %s" % project_name) 
     289 
     290            if disabled_projects: 
     291                disabled_projects.sort() 
     292                print "  Disabled :" 
     293                for project_name in disabled_projects: 
     294                    print style.DISABLED("    - %s" % project_name) 
     295 
    285296 
    286297