1--! @brief get value of a compound flag
2--! @
param[in] args list of arguments
3--! @
param[in] key single
char flag
5--! @retval value when found
6--! @retval
default when not found
7--! @retval NULL when found and not set
default
9 if not args then
return default end
12 while index <= #args
do
13 local
param = args[index]
14 local nextparam = args[index + 1]
15 if param:sub(1, 2) ==
'-'..
'-' and
param:sub(3, #
param) == key and nextparam and nextparam:sub(1, 2) ~=
'-'..
'-' then
23--! @brief verify
if exist a flag
24--! @
param[in] args list of arguments
25--! @
param[in] key single
char flag
27--! @retval
true when found
28--! @retval
false when not found
30 if not args then
return false end
32 while index <= #args
do
33 local
param = args[index]
42--! @brief get a ordered
param
44--! @
param[in] args list of arguments
45--! @
param[in] ignore_keys a list of compound flags to ignore
46--! @
param[in] position order of parameter started by 1
48--! @retval value when found
49--! @retval
default when not found
50--! @retval NULL when found and not set
default
52 if not args then
return default end
55 local ignore_keys2 = {}
58 while index <= #ignore_keys
do
59 ignore_keys2[ignore_keys[index]] =
true
64 while index <= #args
do
65 local arg = args[index]
66 local
param = args[index - 1]
67 if arg:sub(1, 2) ~=
'-'..
'-' then
68 if index <= 1 or (
param and not (
param:sub(1, 2) ==
'-'..
'-' and ignore_keys2[
param:sub(3, #
param)])) then
69 if position == count then
local function shared_args_has(args, key)
verify if exist a flag
local function shared_args_param(args, ignore_keys, position, default)
get a ordered param
local function shared_args_get(args, key, default)
get value of a compound flag
local function param(self, name, value)