comparison makeitso/cli.py @ 85:cb6c54b1adf3

allow .parse() to be consumed
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 10 Jan 2011 12:35:37 -0800
parents 059b02808efa
children e74baa8e6df4
comparison
equal deleted inserted replaced
84:0fbc2bcdabd7 85:cb6c54b1adf3
27 parser.add_option('--%s' % variable.name, dest=variable.name, 27 parser.add_option('--%s' % variable.name, dest=variable.name,
28 default=variable.default, 28 default=variable.default,
29 help=description) 29 help=description)
30 return parser 30 return parser
31 31
32 def parse(self): 32 def parse(self, parser=None, options=None, args=None):
33 parser = self.parser() 33
34 options, args = parser.parse_args() 34 # parse the command line
35 if not parser or not options or not args:
36 parser = self.parser()
37 options, args = parser.parse_args()
35 38
36 # ensure output is given 39 # ensure output is given
37 if len(args) != 1: 40 if len(args) != 1:
38 parser.error("Please specify a single output destination") 41 parser.error("Please specify a single output destination")
39 42