[PATCH 1 of 5 command metadata resend] cmdutil: better document command()
Gregory Szorc
gregory.szorc at gmail.com
Fri Jun 13 13:24:17 CDT 2014
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1399254304 25200
# Sun May 04 18:45:04 2014 -0700
# Node ID b6aa82933dc87e6e48dc40331d612ff425ae4f66
# Parent 0f73ed6293629f69aa2f01d8940e91faeded49ae
cmdutil: better document command()
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2472,10 +2472,25 @@ def _performrevert(repo, parents, ctx, a
if f in copied:
repo.dirstate.copy(copied[f], f)
def command(table):
- '''returns a function object bound to table which can be used as
- a decorator for populating table as a command table'''
+ """Returns a function object to be used as a decorator for making commands.
+
+ This function receives a command table as its argument. The table should
+ be a dict.
+
+ The returned function can be used as a decorator for adding commands
+ to that command table. This function accepts multiple arguments to define
+ a command.
+
+ The first argument is the command name.
+
+ The options argument is an iterable of tuples defining command arguments.
+ See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple.
+
+ The synopsis argument defines a short, one line summary of how to use the
+ command. This shows up in the help output.
+ """
def cmd(name, options=(), synopsis=None):
def decorator(func):
if synopsis:
More information about the Mercurial-devel
mailing list