changeset 21766:a039e1f2326f

cmdutil: better document command()
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 04 May 2014 18:45:04 -0700
parents 44255f7ce886
children 75a96326cecb
files mercurial/cmdutil.py
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Jun 11 22:19:29 2014 -0400
+++ b/mercurial/cmdutil.py	Sun May 04 18:45:04 2014 -0700
@@ -2473,8 +2473,23 @@
             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):