def validate(self): for option in self.subOptions: option.validate() for option in self.subOptions: if option.isApplied() and not self.applied: raise CommandLineUtil.ArgumentError( "%s specified without %s" % (option.getName(), self.longName)) return
def validate(self): # make sure only one of our choices is in the options applied = 0 for opt in self.choices: if opt.isApplied(): if applied: opts = ', '.join( map(lambda x: '--%s' % x.getName(), self.choices)) raise CommandLineUtil.ArgumentError( "Only one of %s allowed" % opts) applied = opt if applied: #NOTE, this allows some sub commands to sneak in applied.validate() else: #Validate them all for option in self.choices: option.validate()