##// END OF EJS Templates
help: add -c/--command flag to only show command help (issue2799)
Martin Geisler -
r14286:005a540e default
parent child Browse files
Show More
@@ -2293,6 +2293,12 b' def help_(ui, name=None, with_version=Fa'
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:
@@ -2346,6 +2352,8 b' def help_(ui, name=None, with_version=Fa'
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:
@@ -4720,8 +4728,9 b' table = {'
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', '',
@@ -90,7 +90,7 b' def _runcatch(ui, args):'
90 except error.CommandError, inst:
90 except error.CommandError, inst:
91 if inst.args[0]:
91 if inst.args[0]:
92 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
92 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
93 commands.help_(ui, inst.args[0], full=False)
93 commands.help_(ui, inst.args[0], full=False, command=True)
94 else:
94 else:
95 ui.warn(_("hg: %s\n") % inst.args[1])
95 ui.warn(_("hg: %s\n") % inst.args[1])
96 commands.help_(ui, 'shortlist')
96 commands.help_(ui, 'shortlist')
@@ -10,6 +10,6 b''
10 $ hg -q help help
10 $ hg -q help help
11 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
11 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
12 *** failed to import extension badext2: No module named badext2
12 *** failed to import extension badext2: No module named badext2
13 hg help [-e] [TOPIC]
13 hg help [-ec] [TOPIC]
14
14
15 show help for a given topic or a help overview
15 show help for a given topic or a help overview
@@ -239,7 +239,7 b' Show all commands + options'
239 debugwireargs: three, four, five, ssh, remotecmd, insecure
239 debugwireargs: three, four, five, ssh, remotecmd, insecure
240 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude
240 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude
241 heads: rev, topo, active, closed, style, template
241 heads: rev, topo, active, closed, style, template
242 help: extension
242 help: extension, command
243 identify: rev, num, id, branch, tags, bookmarks
243 identify: rev, num, id, branch, tags, bookmarks
244 import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
244 import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
245 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
245 incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
@@ -329,6 +329,59 b' Extension module help vs command help:'
329
329
330 $ echo 'extdiff = !' >> $HGRCPATH
330 $ echo 'extdiff = !' >> $HGRCPATH
331
331
332 Test help topic with same name as extension
333
334 $ cat > multirevs.py <<EOF
335 > from mercurial import commands
336 > """multirevs extension
337 > Big multi-line module docstring."""
338 > def multirevs(ui, repo, arg, *args, **opts):
339 > """multirevs command"""
340 > pass
341 > cmdtable = {
342 > "multirevs": (multirevs, [], 'ARG')
343 > }
344 > commands.norepo += ' multirevs'
345 > EOF
346 $ echo "multirevs = multirevs.py" >> $HGRCPATH
347
348 $ hg help multirevs
349 Specifying Multiple Revisions
350
351 When Mercurial accepts more than one revision, they may be specified
352 individually, or provided as a topologically continuous range, separated
353 by the ":" character.
354
355 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
356 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
357 specified, it defaults to revision number 0. If END is not specified, it
358 defaults to the tip. The range ":" thus means "all revisions".
359
360 If BEGIN is greater than END, revisions are treated in reverse order.
361
362 A range acts as a closed interval. This means that a range of 3:5 gives 3,
363 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
364
365 use "hg help -c multirevs" to see help for the multirevs command
366
367 $ hg help -c multirevs
368 hg multirevs ARG
369
370 multirevs command
371
372 use "hg -v help multirevs" to show global options
373
374 $ hg multirevs
375 hg multirevs: invalid arguments
376 hg multirevs ARG
377
378 multirevs command
379
380 use "hg help multirevs" to show the full help text
381 [255]
382
383 $ echo "multirevs = !" >> $HGRCPATH
384
332 Issue811: Problem loading extensions twice (by site and by user)
385 Issue811: Problem loading extensions twice (by site and by user)
333
386
334 $ debugpath=`pwd`/debugissue811.py
387 $ debugpath=`pwd`/debugissue811.py
General Comments 0
You need to be logged in to leave comments. Login now