示例#1
0
    def subCommandUsage(self, subCommandName, errNo=1):
        if not self._subCommands.has_key(subCommandName):
            print "%s %s: no such subcommand: %s" % \
                   (self.mainHandler.name, self.commands[0], subCommandName)
            sys.exit(1)

        thisCommand = self._subCommands[subCommandName]()
        thisCommand.setMainHandler(self.mainHandler)
        params, _ = thisCommand.prepare()
        usage = '%s %s %s %s' % (self.mainHandler.name, '/'.join(self.commands),
                                 subCommandName, thisCommand.paramHelp)
        kwargs = self.mainHandler._getParserFlags(thisCommand)
        kwargs['defaultGroup'] = None
        parser = options._getParser(params, {}, usage=usage, **kwargs)
        parser.print_help()
        if log.getVerbosity() > log.INFO:
            print '(Use --verbose to get a full option listing)'
        return errNo
示例#2
0
    def subCommandUsage(self, subCommandName, errNo=1):
        if not self._subCommands.has_key(subCommandName):
            print "%s %s: no such subcommand: %s" % \
                   (self.mainHandler.name, self.commands[0], subCommandName)
            sys.exit(1)

        thisCommand = self._subCommands[subCommandName]()
        thisCommand.setMainHandler(self.mainHandler)
        params, _ = thisCommand.prepare()
        usage = '%s %s %s %s' % (self.mainHandler.name, '/'.join(self.commands),
                                 subCommandName, thisCommand.paramHelp)
        kwargs = self.mainHandler._getParserFlags(thisCommand)
        kwargs['defaultGroup'] = None
        parser = options._getParser(params, {}, usage=usage, **kwargs)
        parser.print_help()
        if log.getVerbosity() > log.INFO:
            print '(Use --verbose to get a full option listing)'
        return errNo
示例#3
0
 def getParserByClass(self, commandClass, commandName=None):
     params, cfgMap = commandClass.prepare()
     usage = self._getUsageByClass(commandClass, commandName=commandName)
     kwargs = self._getParserFlags(commandClass)
     return options._getParser(params, {}, usage=usage, **kwargs)
示例#4
0
 def getParserByClass(self, commandClass, commandName=None):
     params, cfgMap = commandClass.prepare()
     usage = self._getUsageByClass(commandClass, commandName=commandName)
     kwargs = self._getParserFlags(commandClass)
     return options._getParser(params, {}, usage=usage, **kwargs)