/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: 2020-05-06 02:13:25 UTC
  • mfrom: (7490.7.21 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200506021325-awbmmqu1zyorz7sj
Merge 3.1 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
# TODO: Some way to get a list of external commands (defined by shell
20
18
# scripts) so that they can be included in the help listing as well.
21
19
# It should be enough to just list the plugin directory and look for
23
21
 
24
22
# TODO: `help commands --all` should show hidden commands
25
23
 
26
 
import sys
27
 
 
28
24
from . import (
29
25
    commands as _mod_commands,
30
26
    errors,
39
35
class NoHelpTopic(errors.BzrError):
40
36
 
41
37
    _fmt = ("No help could be found for '%(topic)s'. "
42
 
        "Please use 'brz help topics' to obtain a list of topics.")
 
38
            "Please use 'brz help topics' to obtain a list of topics.")
43
39
 
44
40
    def __init__(self, topic):
45
41
        self.topic = topic
58
54
        shadowed_terms = []
59
55
        for index, topic_obj in topics[1:]:
60
56
            shadowed_terms.append('%s%s' % (index.prefix,
61
 
                topic_obj.get_help_topic()))
 
57
                                            topic_obj.get_help_topic()))
62
58
        source = topics[0][1]
63
59
        outfile.write(source.get_help_text(shadowed_terms))
64
60
    except NoHelpTopic:
67
63
 
68
64
    if alias is not None:
69
65
        outfile.write("'brz %s' is an alias for 'brz %s'.\n" % (topic,
70
 
            " ".join(alias)))
 
66
                                                                " ".join(alias)))
71
67
 
72
68
 
73
69
def help_commands(outfile=None):
169
165
        self._check_prefix_uniqueness()
170
166
        result = []
171
167
        for index in self.search_path:
172
 
            result.extend([(index, _topic) for _topic in index.get_topics(topic)])
 
168
            result.extend([(index, _topic)
 
169
                           for _topic in index.get_topics(topic)])
173
170
        if not result:
174
171
            raise NoHelpTopic(topic)
175
172
        else: