/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 breezy/help.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 19:47:19 UTC
  • mfrom: (7178 work)
  • mto: This revision was merged to the branch mainline in revision 7179.
  • Revision ID: jelmer@jelmer.uk-20181116194719-m5ut2wfuze5x9s1p
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
# TODO: `help commands --all` should show hidden commands
25
25
 
26
 
import sys
27
 
 
28
26
from . import (
29
27
    commands as _mod_commands,
30
28
    errors,
39
37
class NoHelpTopic(errors.BzrError):
40
38
 
41
39
    _fmt = ("No help could be found for '%(topic)s'. "
42
 
        "Please use 'brz help topics' to obtain a list of topics.")
 
40
            "Please use 'brz help topics' to obtain a list of topics.")
43
41
 
44
42
    def __init__(self, topic):
45
43
        self.topic = topic
58
56
        shadowed_terms = []
59
57
        for index, topic_obj in topics[1:]:
60
58
            shadowed_terms.append('%s%s' % (index.prefix,
61
 
                topic_obj.get_help_topic()))
 
59
                                            topic_obj.get_help_topic()))
62
60
        source = topics[0][1]
63
61
        outfile.write(source.get_help_text(shadowed_terms))
64
62
    except NoHelpTopic:
67
65
 
68
66
    if alias is not None:
69
67
        outfile.write("'brz %s' is an alias for 'brz %s'.\n" % (topic,
70
 
            " ".join(alias)))
 
68
                                                                " ".join(alias)))
71
69
 
72
70
 
73
71
def help_commands(outfile=None):
169
167
        self._check_prefix_uniqueness()
170
168
        result = []
171
169
        for index in self.search_path:
172
 
            result.extend([(index, _topic) for _topic in index.get_topics(topic)])
 
170
            result.extend([(index, _topic)
 
171
                           for _topic in index.get_topics(topic)])
173
172
        if not result:
174
173
            raise NoHelpTopic(topic)
175
174
        else: