This repository was archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Options
SquidDev edited this page Jan 5, 2015
·
7 revisions
Arguments are parsed when the program launches in the following patterns:
-
--key=valueSets the optionskeyto bevalue -
--keySets the optionkeyto be true. -
-vtSets the optionsvandtto be true.
Options do not need to be explicitly added, but it is recommended as some features (aliases, using -vt style arguments) will not be available.
All functions can be called in two ways:
Options:Description("verbose", "Print verbose output")
-- or
Options:Option "verbose"
:Description "Print verbose output"The first is suggested for single setters, the second for multiple settings.
-
Default:
:Default(value or true)Set the default value -
Alias:
:Alias(alias)Add an alias the command -
Description:
:Description(description)Set the description (for help contents) -
TakesValue:
:TakesValue(takesValue)If the argument takes a value (for help contents)
Whenever a value is changed the OnChanged event is called. You can listen to it with:
Options:OnChanged(function(parser)
print("Something changed")
end)This is used to update verbose printing, amongst other things.
Call Options:Help(indent = '') to print out the list of options currently available.