Module leste.utils.cli
The cli module provides functions for parsing command-line arguments.
Functions
removeFlags (args) | Removes flags (arguments starting with "-") from the given table of arguments. |
getFlags (removeFromArg) | Parses command-line arguments and returns a table containing parsed flags. |
Functions
- removeFlags (args)
-
Removes flags (arguments starting with "-") from the given table of arguments.
Parameters:
- args table The table of arguments to process.
Returns:
-
table
A new table containing only non-flag arguments, can be assigned to the global
arg
table. - getFlags (removeFromArg)
-
Parses command-line arguments and returns a table containing parsed flags.
Parameters:
- removeFromArg
boolean
If true, removes parsed flags from the global
arg
table. Defaults to false.
Returns:
-
table
A table containing parsed flags:
verbose
(boolean): True if the--verbose
or-v
flag is present.
exitOnFirst
(boolean): True if the--exitfirst
or-x
flag is present. - removeFromArg
boolean
If true, removes parsed flags from the global