FLAG = 1
PARAM = 2
INTPARAM = 3
+ PARAMLIST = 4
def __init__(self, cmd, remain_help, options):
self.options = options
shorts = ""
for opt in options:
long = self.long(opt)
short = self.short(opt)
- if self.type(opt) in (Options.PARAM, Options.INTPARAM):
- if short: short = short + ':'
+ if self.type(opt) in (Options.PARAM, Options.INTPARAM,
+ Options.PARAMLIST):
+ if short: short = short + ':'
if long: long = long + '='
shorts = shorts + short
longs.append(long)
def default(self, option):
if len(option) >= 4:
return option[3]
+ if self.type(option) == Options.PARAMLIST:
+ return []
return None
def lookup_option(self, key, key_func):
val = int(a)
except ValueError, e:
raise error.OptionError("option: '%s' expects integer value, got '%s' " % (o,a))
+ elif self.type(option) == Options.PARAMLIST:
+ val = values[self.key(option)];
+ val.append(a)
else:
val = 1
values[self.key(option)] = val