~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/option.py

  • Committer: Andrew Bennetts
  • Date: 2010-10-13 00:26:41 UTC
  • mto: This revision was merged to the branch mainline in revision 5498.
  • Revision ID: andrew.bennetts@canonical.com-20101013002641-9tlh9k89mlj1666m
Keep docs-plain working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
312
312
 
313
313
    def __init__(self, name, help, registry=None, converter=None,
314
314
        value_switches=False, title=None, enum_switch=True,
315
 
        lazy_registry=None, short_name=None, short_value_switches=None):
 
315
        lazy_registry=None):
316
316
        """
317
317
        Constructor.
318
318
 
328
328
            which takes a value.
329
329
        :param lazy_registry: A tuple of (module name, attribute name) for a
330
330
            registry to be lazily loaded.
331
 
        :param short_name: The short name for the enum switch, if any
332
 
        :param short_value_switches: A dict mapping values to short names
333
331
        """
334
 
        Option.__init__(self, name, help, type=self.convert, short_name=short_name)
 
332
        Option.__init__(self, name, help, type=self.convert)
335
333
        self._registry = registry
336
334
        if registry is None:
337
335
            if lazy_registry is None:
346
344
        self.converter = converter
347
345
        self.value_switches = value_switches
348
346
        self.enum_switch = enum_switch
349
 
        self.short_value_switches = short_value_switches
350
347
        self.title = title
351
348
        if self.title is None:
352
349
            self.title = name
390
387
                    help = optparse.SUPPRESS_HELP
391
388
                else:
392
389
                    help = self.registry.get_help(key)
393
 
                if (self.short_value_switches and
394
 
                    key in self.short_value_switches):
395
 
                    option_strings.append('-%s' %
396
 
                                          self.short_value_switches[key])
397
390
                parser.add_option(action='callback',
398
391
                              callback=self._optparse_value_callback(key),
399
392
                                  help=help,
562
555
_global_option('update')
563
556
_global_registry_option('log-format', "Use specified log format.",
564
557
                        lazy_registry=('bzrlib.log', 'log_formatter_registry'),
565
 
                        value_switches=True, title='Log format',
566
 
                        short_value_switches={'short': 'S'})
 
558
                        value_switches=True, title='Log format')
567
559
_global_option('long', help='Use detailed log format. Same as --log-format long',
568
560
               short_name='l')
569
561
_global_option('short', help='Use moderately short log format. Same as --log-format short')