equal
deleted
inserted
replaced
3061 displayer.show(ctx) |
3061 displayer.show(ctx) |
3062 displayer.close() |
3062 displayer.close() |
3063 |
3063 |
3064 @command('help', |
3064 @command('help', |
3065 [('e', 'extension', None, _('show only help for extensions')), |
3065 [('e', 'extension', None, _('show only help for extensions')), |
3066 ('c', 'command', None, _('show only help for commands'))], |
3066 ('c', 'command', None, _('show only help for commands')), |
|
3067 ('k', 'keyword', '', _('show topics matching keyword')), |
|
3068 ], |
3067 _('[-ec] [TOPIC]')) |
3069 _('[-ec] [TOPIC]')) |
3068 def help_(ui, name=None, unknowncmd=False, full=True, **opts): |
3070 def help_(ui, name=None, unknowncmd=False, full=True, **opts): |
3069 """show help for a given topic or a help overview |
3071 """show help for a given topic or a help overview |
3070 |
3072 |
3071 With no arguments, print a list of commands with short help messages. |
3073 With no arguments, print a list of commands with short help messages. |
3307 doc = _("(no help text available)") |
3309 doc = _("(no help text available)") |
3308 if util.safehasattr(doc, '__call__'): |
3310 if util.safehasattr(doc, '__call__'): |
3309 doc = doc() |
3311 doc = doc() |
3310 |
3312 |
3311 ui.write("%s\n\n" % header) |
3313 ui.write("%s\n\n" % header) |
3312 ui.write("%s" % minirst.format(doc, textwidth, indent=4)) |
3314 ui.write(minirst.format(doc, textwidth, indent=4)) |
3313 try: |
3315 try: |
3314 cmdutil.findcmd(name, table) |
3316 cmdutil.findcmd(name, table) |
3315 ui.write(_('\nuse "hg help -c %s" to see help for ' |
3317 ui.write(_('\nuse "hg help -c %s" to see help for ' |
3316 'the %s command\n') % (name, name)) |
3318 'the %s command\n') % (name, name)) |
3317 except error.UnknownCommand: |
3319 except error.UnknownCommand: |
3356 "extension:") % cmd, {ext: doc}, indent=4) |
3358 "extension:") % cmd, {ext: doc}, indent=4) |
3357 ui.write(minirst.format(msg, textwidth)) |
3359 ui.write(minirst.format(msg, textwidth)) |
3358 ui.write('\n') |
3360 ui.write('\n') |
3359 ui.write(_('use "hg help extensions" for information on enabling ' |
3361 ui.write(_('use "hg help extensions" for information on enabling ' |
3360 'extensions\n')) |
3362 'extensions\n')) |
|
3363 |
|
3364 kw = opts.get('keyword') |
|
3365 if kw: |
|
3366 matches = help.topicmatch(kw) |
|
3367 for t, title in (('topics', _('Topics')), |
|
3368 ('commands', _('Commands')), |
|
3369 ('extensions', _('Extensions')), |
|
3370 ('extensioncommands', _('Extension Commands'))): |
|
3371 if matches[t]: |
|
3372 ui.write('%s:\n' % title) |
|
3373 ui.write(minirst.format(minirst.maketable(matches[t]))) |
|
3374 return |
3361 |
3375 |
3362 if name and name != 'shortlist': |
3376 if name and name != 'shortlist': |
3363 i = None |
3377 i = None |
3364 if unknowncmd: |
3378 if unknowncmd: |
3365 queries = (helpextcmd,) |
3379 queries = (helpextcmd,) |