Ek generates C++ code from the usage string of a console application. The generated code makes all the input parameters available to the application as static members of the generated class.
The format of the usage string that Ek accepts is influenced by the PowerShell help content. Following are the command line params:
The flags are specified as [-FlagName]
in the usage string.
A parameter can be specified in any of the following ways:
-
[-ParamName <param value help text>]
The presence of square brackets makes a parameter property optional. Here,
ParamName
is an optional parameter and the generated code would not terminate with error if the user does not provideParamName
value at the time of invoking the associate console application. -
[-ParamName] <param value help text>
ParamName
is optional here, but the parameter value is not. Therefore, the command line can pass this value without specifying-ParamName
. -
[[-ParamName] <param value help text>]
This parameter is optional, and if specified, does not need
-ParamName
always. In this case, both the parameter and the name specifier are optional. -
-ParamName <param value help text>
There are no optional parts to this parameter. This parameter value should be specified by the user always, and with the
-ParamName
specifier.
-
shutdown [-m] [-k] [-comp] <computer name> -timer <number in seconds>
This shows a usage string with four parameters. Two are flags,
-m
, and-k
. Two others are parameters. Please note that value of timer always needs to be specified by-Timer
, but passing a string would be assumed to becomputer name
without always requiring its specifier-comp
. -
ek [-str] <usage string> [-outnamespace <name space>] -out <filename without extension>
This is the usage string of Ek. Every parameter is required here, except
outnamespace
. We use the generated code in the Ek project itself.