186
186
self.argname = argname
187
187
if param_name is None:
188
self._param_name = self.name
188
self._param_name = self.name.replace('-', '_')
190
190
self._param_name = param_name
191
191
self.custom_callback = custom_callback
210
210
option_strings.append('-%s' % short_name)
211
211
optargfn = self.type
212
212
if optargfn is None:
213
parser.add_option(action='callback',
214
callback=self._optparse_bool_callback,
213
parser.add_option(action='callback',
214
callback=self._optparse_bool_callback,
215
215
callback_args=(True,),
218
218
negation_strings = ['--%s' % self.get_negation_name()]
219
parser.add_option(action='callback',
220
callback=self._optparse_bool_callback,
219
parser.add_option(action='callback',
220
callback=self._optparse_bool_callback,
221
221
callback_args=(False,),
222
222
help=optparse.SUPPRESS_HELP, *negation_strings)
224
parser.add_option(action='callback',
225
callback=self._optparse_callback,
224
parser.add_option(action='callback',
225
callback=self._optparse_callback,
226
226
type='string', metavar=self.argname.upper(),
228
default=OptionParser.DEFAULT_VALUE,
228
default=OptionParser.DEFAULT_VALUE,
231
231
def _optparse_bool_callback(self, option, opt_str, value, parser, bool_v):