~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Robert Collins
  • Date: 2010-05-06 23:54:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506235405-wii4elupfhzl3jvy
Add __str__ to the new helper classes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
397
397
            will not mangled.
398
398
 
399
399
    :cvar hooks: An instance of CommandHooks.
400
 
    :ivar __doc__: The help shown by 'bzr help command' for this command.
401
 
        This is set by assigning explicitly to __doc__ so that -OO can
402
 
        be used::
403
 
 
404
 
        class Foo(Command):
405
 
            __doc__ = "My help goes here"
406
400
    """
407
401
    aliases = []
408
402
    takes_args = []
413
407
 
414
408
    def __init__(self):
415
409
        """Construct an instance of this command."""
 
410
        if self.__doc__ == Command.__doc__:
 
411
            warn("No help message set for %r" % self)
416
412
        # List of standard options directly supported
417
413
        self.supported_std_options = []
418
414
        self._setup_run()
486
482
            message explaining how to obtain full help.
487
483
        """
488
484
        doc = self.help()
489
 
        if not doc:
490
 
            doc = "No help for this command."
 
485
        if doc is None:
 
486
            raise NotImplementedError("sorry, no detailed help yet for %r" % self.name())
491
487
 
492
488
        # Extract the summary (purpose) and sections out from the text
493
489
        purpose,sections,order = self._get_help_parts(doc)
1081
1077
    if not opt_no_aliases:
1082
1078
        alias_argv = get_alias(argv[0])
1083
1079
        if alias_argv:
 
1080
            user_encoding = osutils.get_user_encoding()
 
1081
            alias_argv = [a.decode(user_encoding) for a in alias_argv]
1084
1082
            argv[0] = alias_argv.pop(0)
1085
1083
 
1086
1084
    cmd = argv.pop(0)
 
1085
    # We want only 'ascii' command names, but the user may have typed
 
1086
    # in a Unicode name. In that case, they should just get a
 
1087
    # 'command not found' error later.
 
1088
 
1087
1089
    cmd_obj = get_cmd_object(cmd, plugins_override=not opt_builtin)
1088
1090
    run = cmd_obj.run_argv_aliases
1089
1091
    run_argv = [argv, alias_argv]