diff profilemanager/manager.py @ 5:ca57920aa223

adding better formatting for list
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 06 Apr 2010 08:04:24 -0700
parents 35dc297efa25
children 2a3f5cdfd60c
line wrap: on
line diff
--- a/profilemanager/manager.py	Mon Apr 05 13:53:22 2010 -0700
+++ b/profilemanager/manager.py	Tue Apr 06 08:04:24 2010 -0700
@@ -4,6 +4,8 @@
 
 import os
 import shutil
+from utils import format_tabular
+from ConfigParser import SafeConfigParser as ConfigParser
 
 class ProfileNotFound(Exception):
     """
@@ -26,15 +28,14 @@
         """
         lists the profiles available in the config file
         """
-        from ConfigParser import SafeConfigParser as ConfigParser
         parser = ConfigParser()
         parser.read(self.profiles)
         names = []
         for section in parser.sections():
             if section == 'General':
                 continue
-            names.append(parser.get(section, 'name'))
-        return '\n'.join(names)
+            names.append((parser.get(section, 'name'),))
+        return format_tabular(names)
 
     def clone(self, source, dest):
         """
@@ -70,7 +71,7 @@
             # delete the backup
             pass
 
-    def merge(self, *profiles):
+    def merge(self, output, *profiles):
         """merge a set of profiles (not trivial!)"""
         raise NotImplementedError
 
@@ -79,3 +80,8 @@
     def path(self, profile):
         """returns the path to the profile"""
 
+    def profile_dict(self, profile):
+        parser = ConfigParser()
+        parser.read(self.profiles)
+        for section in parser.sections():
+            raise NotImplementedError