# -*- Mode: Python -*- # vi:si:et:sw=4:sts=4:ts=4 import sys from morituri.common import log, logcommand from morituri.rip import cd, offset, drive, image def main(argv): c = Rip() try: ret = c.parse(argv) except SystemError, e: sys.stderr.write('rip: error: %s\n' % e.args) return 255 except ImportError, e: # FIXME: decide how to handle raise # deps.handleImportError(e) # ret = -1 if ret is None: return 0 return ret class Rip(logcommand.LogCommand): usage = "%prog %command" description = """Rip rips CD's. Rip gives you a tree of subcommands to work with. You can get help on subcommands by using the -h option to the subcommand. """ subCommandClasses = [cd.CD, drive.Drive, offset.Offset, image.Image, ] def addOptions(self): # FIXME: is this the right place ? log.init() self.parser.add_option('-v', '--version', action="store_true", dest="version", help="show version information") def handleOptions(self, options): if options.version: from morituri.configure import configure print "rip %s" % configure.version sys.exit(0)