##// END OF EJS Templates
help: fix help -c/help -e/help -k...
timeless -
r27325:eadbbd14 default
parent child Browse files
Show More
@@ -854,7 +854,7 b' def _dispatch(req):'
854 854 if options['version']:
855 855 return commands.version_(ui)
856 856 if options['help']:
857 return commands.help_(ui, cmd, command=True)
857 return commands.help_(ui, cmd, command=cmd is not None)
858 858 elif not cmd:
859 859 return commands.help_(ui, 'shortlist')
860 860
@@ -328,7 +328,7 b' def help_(ui, name, unknowncmd=False, fu'
328 328 return rst
329 329
330 330
331 def helplist(select=None):
331 def helplist(select=None, **opts):
332 332 # list of commands
333 333 if name == "shortlist":
334 334 header = _('basic commands:\n\n')
@@ -374,7 +374,9 b' def help_(ui, name, unknowncmd=False, fu'
374 374 else:
375 375 rst.append(' :%s: %s\n' % (f, h[f]))
376 376
377 if not name:
377 ex = opts.get
378 anyopts = (ex('keyword') or not (ex('command') or ex('extension')))
379 if not name and anyopts:
378 380 exts = listexts(_('enabled extensions:'), extensions.enabled())
379 381 if exts:
380 382 rst.append('\n')
@@ -491,8 +493,8 b' def help_(ui, name, unknowncmd=False, fu'
491 493
492 494 rst = []
493 495 kw = opts.get('keyword')
494 if kw:
495 matches = topicmatch(ui, name)
496 if kw or name is None and any(opts[o] for o in opts):
497 matches = topicmatch(ui, name or '')
496 498 helpareas = []
497 499 if opts.get('extension'):
498 500 helpareas += [('extensions', _('Extensions'))]
@@ -539,6 +541,6 b' def help_(ui, name, unknowncmd=False, fu'
539 541 # program name
540 542 if not ui.quiet:
541 543 rst = [_("Mercurial Distributed SCM\n"), '\n']
542 rst.extend(helplist())
544 rst.extend(helplist(None, **opts))
543 545
544 546 return ''.join(rst)
@@ -1043,16 +1043,25 b' Test help hooks'
1043 1043
1044 1044 help -c should only show debug --debug
1045 1045
1046 $ hg help -c --debug|grep debug|wc -l|grep '^\s*0\s*$'
1046 $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$'
1047 1047 [1]
1048 1048
1049 1049 help -c should only show deprecated for -v
1050 1050
1051 $ hg help -c -v|grep DEPRECATED|wc -l|grep '^\s*0\s*$'
1051 $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
1052 1052 [1]
1053 1053
1054 1054 Test -e / -c / -k combinations
1055 1055
1056 $ hg help -c|egrep '^\S|debug'
1057 Commands:
1058 $ hg help -e|egrep '^\S'
1059 Extensions:
1060 $ hg help -k|egrep '^\S'
1061 Topics:
1062 Commands:
1063 Extensions:
1064 Extension Commands:
1056 1065 $ hg help -c schemes
1057 1066 abort: no such help topic: schemes
1058 1067 (try "hg help --keyword schemes")
General Comments 0
You need to be logged in to leave comments. Login now