mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
Document command_target
This commit is contained in:
@@ -35,6 +35,29 @@ A typo will result in an appropriate error message.
|
||||
Error: unknown command 'instal'
|
||||
Did you mean 'install'?
|
||||
|
||||
Getting name of selected command
|
||||
--------------------------------
|
||||
|
||||
Use ``command_target`` property of the parser to store the name of used command in a field of the result table.
|
||||
|
||||
.. code-block:: lua
|
||||
:linenos:
|
||||
|
||||
parser:command_target("command")
|
||||
parser:command("install")
|
||||
parser:command("remove")
|
||||
|
||||
::
|
||||
|
||||
$ lua script.lua install
|
||||
|
||||
.. code-block:: lua
|
||||
|
||||
{
|
||||
install = true,
|
||||
command = "install"
|
||||
}
|
||||
|
||||
Adding elements to commands
|
||||
---------------------------
|
||||
|
||||
|
@@ -176,6 +176,7 @@ Property Type
|
||||
``require_command`` Boolean
|
||||
``handle_options`` Boolean
|
||||
``add_help`` Boolean or string or table
|
||||
``command_target`` String
|
||||
=================== ==========================
|
||||
|
||||
Command properties
|
||||
@@ -203,6 +204,7 @@ Property Type
|
||||
``handle_options`` Boolean
|
||||
``action`` Function
|
||||
``add_help`` Boolean or string or table
|
||||
``command_target`` String
|
||||
=================== ==========================
|
||||
|
||||
Argument properties
|
||||
|
Reference in New Issue
Block a user