# HG changeset patch # User Gregory Szorc # Date 2014-05-05 01:45:04 # Node ID a039e1f2326f131e743f50492bb089e9b1140bb1 # Parent 44255f7ce886c0c4efc59ba8aea15e57ddc23f4c cmdutil: better document command() diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2473,8 +2473,23 @@ def _performrevert(repo, parents, ctx, a 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):