comparison mercurial/commands.py @ 14286:005a540e9aee

help: add -c/--command flag to only show command help (issue2799)
author Martin Geisler <mg@aragost.com>
date Tue, 10 May 2011 14:42:53 +0200
parents aa64a87b493d
children d68ddccf276b
comparison
equal deleted inserted replaced
14285:aa64a87b493d 14286:005a540e9aee
2291 if hasattr(doc, '__call__'): 2291 if hasattr(doc, '__call__'):
2292 doc = doc() 2292 doc = doc()
2293 2293
2294 ui.write("%s\n\n" % header) 2294 ui.write("%s\n\n" % header)
2295 ui.write("%s\n" % minirst.format(doc, textwidth, indent=4)) 2295 ui.write("%s\n" % minirst.format(doc, textwidth, indent=4))
2296 try:
2297 cmdutil.findcmd(name, table)
2298 ui.write(_('\nuse "hg help -c %s" to see help for '
2299 'the %s command\n') % (name, name))
2300 except error.UnknownCommand:
2301 pass
2296 2302
2297 def helpext(name): 2303 def helpext(name):
2298 try: 2304 try:
2299 mod = extensions.find(name) 2305 mod = extensions.find(name)
2300 doc = gettext(mod.__doc__) or _('no help text available') 2306 doc = gettext(mod.__doc__) or _('no help text available')
2344 i = None 2350 i = None
2345 if unknowncmd: 2351 if unknowncmd:
2346 queries = (helpextcmd,) 2352 queries = (helpextcmd,)
2347 elif opts.get('extension'): 2353 elif opts.get('extension'):
2348 queries = (helpext,) 2354 queries = (helpext,)
2355 elif opts.get('command'):
2356 queries = (helpcmd,)
2349 else: 2357 else:
2350 queries = (helptopic, helpcmd, helpext, helpextcmd) 2358 queries = (helptopic, helpcmd, helpext, helpextcmd)
2351 for f in queries: 2359 for f in queries:
2352 try: 2360 try:
2353 f(name) 2361 f(name)
4718 ('c', 'closed', False, 4726 ('c', 'closed', False,
4719 _('show normal and closed branch heads')), 4727 _('show normal and closed branch heads')),
4720 ] + templateopts, 4728 ] + templateopts,
4721 _('[-ac] [-r STARTREV] [REV]...')), 4729 _('[-ac] [-r STARTREV] [REV]...')),
4722 "help": (help_, 4730 "help": (help_,
4723 [('e', 'extension', None, _('show only help for extensions'))], 4731 [('e', 'extension', None, _('show only help for extensions')),
4724 _('[-e] [TOPIC]')), 4732 ('c', 'command', None, _('show only help for commands'))],
4733 _('[-ec] [TOPIC]')),
4725 "identify|id": 4734 "identify|id":
4726 (identify, 4735 (identify,
4727 [('r', 'rev', '', 4736 [('r', 'rev', '',
4728 _('identify the specified revision'), _('REV')), 4737 _('identify the specified revision'), _('REV')),
4729 ('n', 'num', None, _('show local revision number')), 4738 ('n', 'num', None, _('show local revision number')),