Skip to content

Commit

Permalink
Document command action second argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeterv committed Dec 9, 2015
1 parent 413d3e3 commit bebd56c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docsrc/callbacks.rst
Expand Up @@ -232,13 +232,13 @@ Examples using ``store_false`` and ``concat`` actions:
Command actions
^^^^^^^^^^^^^^^

Actions for parsers and commands are simply callbacks invoked after parsing, with the argument table as the only argument. Actions for nested commands are called first.
Actions for parsers and commands are simply callbacks invoked after parsing, with result table and command name as the arguments. Actions for nested commands are called first.

.. code-block:: lua
:linenos:
local install = parser:command("install"):action(function(args)
print("Running install...")
local install = parser:command("install"):action(function(args, name)
print("Running " .. name)
-- Use args here
)
Expand All @@ -252,5 +252,5 @@ Actions for parsers and commands are simply callbacks invoked after parsing, wit

::

Running install...
Running install
Callbacks are fun!

0 comments on commit bebd56c

Please sign in to comment.