Show More
@@ -3942,9 +3942,9 b' def heads(ui, repo, *branchrevs, **opts)' | |||||
3942 | @command('help', |
|
3942 | @command('help', | |
3943 | [('e', 'extension', None, _('show only help for extensions')), |
|
3943 | [('e', 'extension', None, _('show only help for extensions')), | |
3944 | ('c', 'command', None, _('show only help for commands')), |
|
3944 | ('c', 'command', None, _('show only help for commands')), | |
3945 |
('k', 'keyword', |
|
3945 | ('k', 'keyword', None, _('show topics matching keyword')), | |
3946 | ], |
|
3946 | ], | |
3947 | _('[-ec] [TOPIC]'), |
|
3947 | _('[-eck] [TOPIC]'), | |
3948 | norepo=True) |
|
3948 | norepo=True) | |
3949 | def help_(ui, name=None, **opts): |
|
3949 | def help_(ui, name=None, **opts): | |
3950 | """show help for a given topic or a help overview |
|
3950 | """show help for a given topic or a help overview |
@@ -475,11 +475,18 b' def help_(ui, name, unknowncmd=False, fu' | |||||
475 | rst = [] |
|
475 | rst = [] | |
476 | kw = opts.get('keyword') |
|
476 | kw = opts.get('keyword') | |
477 | if kw: |
|
477 | if kw: | |
478 |
matches = topicmatch( |
|
478 | matches = topicmatch(name) | |
479 | for t, title in (('topics', _('Topics')), |
|
479 | helpareas = [] | |
|
480 | if opts.get('extension'): | |||
|
481 | helpareas += [('extensions', _('Extensions'))] | |||
|
482 | if opts.get('command'): | |||
|
483 | helpareas += [('commands', _('Commands'))] | |||
|
484 | if not helpareas: | |||
|
485 | helpareas = [('topics', _('Topics')), | |||
480 | ('commands', _('Commands')), |
|
486 | ('commands', _('Commands')), | |
481 | ('extensions', _('Extensions')), |
|
487 | ('extensions', _('Extensions')), | |
482 |
('extensioncommands', _('Extension Commands')) |
|
488 | ('extensioncommands', _('Extension Commands'))] | |
|
489 | for t, title in helpareas: | |||
483 | if matches[t]: |
|
490 | if matches[t]: | |
484 | rst.append('%s:\n\n' % title) |
|
491 | rst.append('%s:\n\n' % title) | |
485 | rst.extend(minirst.maketable(sorted(matches[t]), 1)) |
|
492 | rst.extend(minirst.maketable(sorted(matches[t]), 1)) | |
@@ -489,13 +496,14 b' def help_(ui, name, unknowncmd=False, fu' | |||||
489 | hint = _('try "hg help" for a list of topics') |
|
496 | hint = _('try "hg help" for a list of topics') | |
490 | raise util.Abort(msg, hint=hint) |
|
497 | raise util.Abort(msg, hint=hint) | |
491 | elif name and name != 'shortlist': |
|
498 | elif name and name != 'shortlist': | |
|
499 | queries = [] | |||
492 | if unknowncmd: |
|
500 | if unknowncmd: | |
493 |
queries = |
|
501 | queries += [helpextcmd] | |
494 |
|
|
502 | if opts.get('extension'): | |
495 |
queries = |
|
503 | queries += [helpext] | |
496 |
|
|
504 | if opts.get('command'): | |
497 |
queries = |
|
505 | queries += [helpcmd] | |
498 |
|
|
506 | if not queries: | |
499 | queries = (helptopic, helpcmd, helpext, helpextcmd) |
|
507 | queries = (helptopic, helpcmd, helpext, helpextcmd) | |
500 | for f in queries: |
|
508 | for f in queries: | |
501 | try: |
|
509 | try: |
@@ -988,6 +988,28 b' Test help hooks' | |||||
988 | helphook1 |
|
988 | helphook1 | |
989 | helphook2 |
|
989 | helphook2 | |
990 |
|
990 | |||
|
991 | Test -e / -c / -k combinations | |||
|
992 | ||||
|
993 | $ hg help -c progress | |||
|
994 | abort: no such help topic: progress | |||
|
995 | (try "hg help --keyword progress") | |||
|
996 | [255] | |||
|
997 | $ hg help -e progress |head -1 | |||
|
998 | progress extension - show progress bars for some actions (DEPRECATED) | |||
|
999 | $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):' | |||
|
1000 | Commands: | |||
|
1001 | $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):' | |||
|
1002 | Extensions: | |||
|
1003 | $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):' | |||
|
1004 | Extensions: | |||
|
1005 | Commands: | |||
|
1006 | $ hg help -c commit > /dev/null | |||
|
1007 | $ hg help -e -c commit > /dev/null | |||
|
1008 | $ hg help -e commit > /dev/null | |||
|
1009 | abort: no such help topic: commit | |||
|
1010 | (try "hg help --keyword commit") | |||
|
1011 | [255] | |||
|
1012 | ||||
991 | Test keyword search help |
|
1013 | Test keyword search help | |
992 |
|
1014 | |||
993 | $ cat > prefixedname.py <<EOF |
|
1015 | $ cat > prefixedname.py <<EOF |
General Comments 0
You need to be logged in to leave comments.
Login now