/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2011-03-25 09:40:37 UTC
  • mto: This revision was merged to the branch mainline in revision 5802.
  • Revision ID: mbp@canonical.com-20110325094037-my0mdjza0vvlrz4g
Add Command.invoked_as

Show diffs side-by-side

added added

removed removed

Lines of Context:
276
276
    # Allow plugins to extend commands
277
277
    for hook in Command.hooks['extend_command']:
278
278
        hook(cmd)
 
279
    if getattr(cmd, 'invoked_as', None) is None:
 
280
        cmd.invoked_as = cmd_name
279
281
    return cmd
280
282
 
281
283
 
397
399
            sys.stdout is forced to be a binary stream, and line-endings
398
400
            will not mangled.
399
401
 
 
402
    :ivar invoked_as:
 
403
        A string indicating the real name under which this command was
 
404
        invoked, before expansion of aliases. 
 
405
        (This may be None if the command was constructed and run in-process.)
 
406
 
400
407
    :cvar hooks: An instance of CommandHooks.
 
408
 
401
409
    :ivar __doc__: The help shown by 'bzr help command' for this command.
402
410
        This is set by assigning explicitly to __doc__ so that -OO can
403
411
        be used::
409
417
    takes_args = []
410
418
    takes_options = []
411
419
    encoding_type = 'strict'
 
420
    invoked_as = None
412
421
 
413
422
    hidden = False
414
423
 
752
761
        return getdoc(self)
753
762
 
754
763
    def name(self):
 
764
        """Return the canonical name for this command.
 
765
 
 
766
        The name under which it was actually invoked is available in invoked_as.
 
767
        """
755
768
        return _unsquish_command_name(self.__class__.__name__)
756
769
 
757
770
    def plugin_name(self):