Package moap :: Module main
[hide private]
[frames] | no frames]

Source Code for Module moap.main

 1  # -*- Mode: Python -*- 
 2  # vi:si:et:sw=4:sts=4:ts=4 
 3   
 4  import sys 
 5   
 6  from moap.command import doap, cl, ignore, bug, code, tracadmin 
 7   
 8  from moap.util import log, util, deps 
 9   
10 -def main(argv):
11 c = Moap() 12 try: 13 ret = c.parse(argv) 14 except SystemError, e: 15 sys.stderr.write('moap: error: %s\n' % e.args) 16 return 255 17 except ImportError, e: 18 deps.handleImportError(e) 19 ret = -1 20 21 if ret is None: 22 return 0 23 return ret
24
25 -class Moap(util.LogCommand):
26 usage = "%prog %command" 27 description = """Moap helps you maintain projects. 28 29 Moap gives you a tree of subcommands to work with. 30 You can get help on subcommands by using the -h option to the subcommand. 31 """ 32 33 subCommandClasses = [doap.Doap, cl.ChangeLog, ignore.Ignore, bug.Bug, 34 code.Code, tracadmin.TracAdmin] 35
36 - def addOptions(self):
37 # FIXME: is this the right place ? 38 log.init() 39 40 self.parser.add_option('-v', '--version', 41 action="store_true", dest="version", 42 help="show version information")
43
44 - def handleOptions(self, options):
45 if options.version: 46 from moap.configure import configure 47 print "moap %s" % configure.version 48 sys.exit(0)
49