From ec3d22f4992daf3644fa086f2c5decb5c50522e4 Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Thu, 30 May 2019 01:37:01 -0400 Subject: [PATCH] Add example for option with argument choices --- docsrc/options.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docsrc/options.rst b/docsrc/options.rst index f88bc04..d8f7a6e 100644 --- a/docsrc/options.rst +++ b/docsrc/options.rst @@ -112,6 +112,22 @@ Setting argument choices The ``choices`` property can be used to specify a list of choices for an option argument in the same way as for arguments. +.. code-block:: lua + :linenos: + + parser:option "--format" + :choices {"short", "medium", "full"} + +.. code-block:: none + + $ lua script.lua --format foo + +.. code-block:: none + + Usage: script.lua [-h] [--format {short,medium,full}] + + Error: argument for option '--format' must be one of 'short', 'medium', 'full' + Setting number of invocations -----------------------------