Specialization of abstract interface class ConfigurationPlugin, which takes all command line parameters in the constructor and reads variable values from those parameters on request. Its priority value usually is Configuration.PrioCLIArgs, which is higher than all other default plug-ins provided.
Variable categories are used as a prefix together with an underscore '_'
. This means, if variable LOCALE in category ALIB is accessed, the command line parameter –ALIB_LOCALE=xyz is read.
Category and Variable names are insensitive in respect to character case.
Command line variables may be passed with either one hyphen ('-') or two ('–'). Both are accepted.
An application can specify one or more "default categories" by adding their string names to public field DefaultCategories. Variables of these categories are recognized by the plug-in also when given without the prefix of category name and underscore '_'
.
Furthermore, an application may set public field AllowedMinimumShortCut to a value greater than 0
. In this case, the plug-in recognizes variables in CLI arguments already when at least this amount of characters is provided. In other words, when reading an argument as many characters of the variable name as possible are 'consumed' and if a minimum number is given with AllowedMinimumShortCut, such minimum is sufficient. If the remaining part of the argument string is either empty or continues with an equal sign '='
, then the variable is recognized (with an empty value or the value after the equal sign).
Fields AllowedMinimumShortCut and DefaultCategories may also be used in combination.
Public Fields | |
int | AllowedMinimumShortCut = 0 |
List< String > | DefaultCategories = new List<String>() |
Public Fields inherited from ConfigurationPlugin | |
XTernalizer | StringConverter |
Public Methods | |
override bool | Load (Variable variable, bool searchOnly=false) |
void | SetArgs (String[] args) |
Public Methods inherited from ConfigurationPlugin | |
virtual bool | Store (Variable variable) |
virtual bool | Store (Variable variable, Object externalizedValue) |
Protected Fields | |
String[] | args |
Protected Fields inherited from ConfigurationPlugin | |
XTernalizer | defaultStringConverter = new XTernalizer() |
Additional Inherited Members | |
Protected Methods inherited from ConfigurationPlugin | |
ConfigurationPlugin () | |
|
inlinevirtual |
Searches the variable in the command line parameters.
variable | The variable to retrieve. |
searchOnly | If true , the variable is not read. Defaults to false . |
true
if variable was found, false
if not. Implements ConfigurationPlugin.
|
inline |
Sets the command line argument list. Needs to be called once after construction. Should not be invoked directly. Rather use Configuration.SetCommandLineArgs.
args | Parameters taken from standard C# method main() (the list of command line arguments). Defaults to null. |
int AllowedMinimumShortCut = 0 |
If this field is set to a value greater than 0
, this plug-in recognizes variables in CLI arguments already when at least this amount of characters is provided. If the remaining part of the argument string is either empty or continues with an equal sign '='
, then the variable is recognized.
|
protected |
The list of command line arguments.
List<String> DefaultCategories = new List<String>() |
An application can specify one or more "default categories" by adding the category names here. Variables of these categories are recognized by the plug-in also when given without the prefix of category_
.