mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 11:02: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'
|
Error: unknown command 'instal'
|
||||||
Did you mean 'install'?
|
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
|
Adding elements to commands
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
@@ -176,6 +176,7 @@ Property Type
|
|||||||
``require_command`` Boolean
|
``require_command`` Boolean
|
||||||
``handle_options`` Boolean
|
``handle_options`` Boolean
|
||||||
``add_help`` Boolean or string or table
|
``add_help`` Boolean or string or table
|
||||||
|
``command_target`` String
|
||||||
=================== ==========================
|
=================== ==========================
|
||||||
|
|
||||||
Command properties
|
Command properties
|
||||||
@@ -203,6 +204,7 @@ Property Type
|
|||||||
``handle_options`` Boolean
|
``handle_options`` Boolean
|
||||||
``action`` Function
|
``action`` Function
|
||||||
``add_help`` Boolean or string or table
|
``add_help`` Boolean or string or table
|
||||||
|
``command_target`` String
|
||||||
=================== ==========================
|
=================== ==========================
|
||||||
|
|
||||||
Argument properties
|
Argument properties
|
||||||
|
Reference in New Issue
Block a user