changeset 85:cb6c54b1adf3

allow .parse() to be consumed
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 10 Jan 2011 12:35:37 -0800
parents 0fbc2bcdabd7
children 2c1310e94645
files makeitso/cli.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/makeitso/cli.py	Sun Jan 09 11:20:16 2011 -0800
+++ b/makeitso/cli.py	Mon Jan 10 12:35:37 2011 -0800
@@ -29,9 +29,12 @@
                         help=description)
     return parser
 
-  def parse(self):
-    parser = self.parser()
-    options, args = parser.parse_args()
+  def parse(self, parser=None, options=None, args=None):
+
+    # parse the command line
+    if not parser or not options or not args:
+      parser = self.parser()
+      options, args = parser.parse_args()
 
     # ensure output is given
     if len(args) != 1: