~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/option.py

  • Committer: Robert Collins
  • Date: 2008-09-02 05:28:37 UTC
  • mfrom: (3675 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3677.
  • Revision ID: robertc@robertcollins.net-20080902052837-ec3qlv41q5e7f6fl
Resolve conflicts with NEWS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
            argname = 'ARG'
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('-', '_')
189
189
        else:
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,),
216
216
                              help=self.help,
217
217
                              *option_strings)
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)
223
223
        else:
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(),
227
227
                              help=self.help,
228
 
                              default=OptionParser.DEFAULT_VALUE, 
 
228
                              default=OptionParser.DEFAULT_VALUE,
229
229
                              *option_strings)
230
230
 
231
231
    def _optparse_bool_callback(self, option, opt_str, value, parser, bool_v):