113 docs = _(getattr(entry[0], '__doc__', None)) or '' |
113 docs = _(getattr(entry[0], '__doc__', None)) or '' |
114 if kw in cmd or lowercontains(summary) or lowercontains(docs): |
114 if kw in cmd or lowercontains(summary) or lowercontains(docs): |
115 doclines = docs.splitlines() |
115 doclines = docs.splitlines() |
116 if doclines: |
116 if doclines: |
117 summary = doclines[0] |
117 summary = doclines[0] |
118 cmdname = cmd.split('|')[0].lstrip('^') |
118 cmdname = cmd.partition('|')[0].lstrip('^') |
119 results['commands'].append((cmdname, summary)) |
119 results['commands'].append((cmdname, summary)) |
120 for name, docs in itertools.chain( |
120 for name, docs in itertools.chain( |
121 extensions.enabled(False).iteritems(), |
121 extensions.enabled(False).iteritems(), |
122 extensions.disabled().iteritems()): |
122 extensions.disabled().iteritems()): |
123 # extensions.load ignores the UI argument |
123 # extensions.load ignores the UI argument |
124 mod = extensions.load(None, name, '') |
124 mod = extensions.load(None, name, '') |
125 name = name.split('.')[-1] |
125 name = name.rpartition('.')[-1] |
126 if lowercontains(name) or lowercontains(docs): |
126 if lowercontains(name) or lowercontains(docs): |
127 # extension docs are already translated |
127 # extension docs are already translated |
128 results['extensions'].append((name, docs.splitlines()[0])) |
128 results['extensions'].append((name, docs.splitlines()[0])) |
129 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems(): |
129 for cmd, entry in getattr(mod, 'cmdtable', {}).iteritems(): |
130 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])): |
130 if kw in cmd or (len(entry) > 2 and lowercontains(entry[2])): |
131 cmdname = cmd.split('|')[0].lstrip('^') |
131 cmdname = cmd.partition('|')[0].lstrip('^') |
132 if entry[0].__doc__: |
132 if entry[0].__doc__: |
133 cmddoc = gettext(entry[0].__doc__).splitlines()[0] |
133 cmddoc = gettext(entry[0].__doc__).splitlines()[0] |
134 else: |
134 else: |
135 cmddoc = _('(no help text available)') |
135 cmddoc = _('(no help text available)') |
136 results['extensioncommands'].append((cmdname, cmddoc)) |
136 results['extensioncommands'].append((cmdname, cmddoc)) |
328 header = _('list of commands:\n\n') |
328 header = _('list of commands:\n\n') |
329 |
329 |
330 h = {} |
330 h = {} |
331 cmds = {} |
331 cmds = {} |
332 for c, e in commands.table.iteritems(): |
332 for c, e in commands.table.iteritems(): |
333 f = c.split("|", 1)[0] |
333 f = c.partition("|")[0] |
334 if select and not select(f): |
334 if select and not select(f): |
335 continue |
335 continue |
336 if (not select and name != 'shortlist' and |
336 if (not select and name != 'shortlist' and |
337 e[0].__module__ != commands.__name__): |
337 e[0].__module__ != commands.__name__): |
338 continue |
338 continue |