Ignite-UX Custom Configuration files
-c which need
s to be able to take any specified value (a user name)
Since -a is fixed we don't do anything about it. We only need to do something about the variable
parts.
For option -b we need to create it as an enum because it only takes one of a specific set of values.
We don’t need to worry about special configurations to ensure that the user sets a specific value,
as in this case we have chosen a suitable default of “5”.
enum _my_command_b_option
_my_command_b_option = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }
init _my_command_b_option = "5"
_my_command_b_option visible_if TRUE
_my_command_b_option help_text "command -b value"
For -c it's a bit easier since we want to allow any value (since you can't validate a user name):
init _my_command_c_option = "user1"
_my_command_c_option visible_if TRUE
_my_command_c_option help_text "command -c value"
It's important to remember the init in front of the variable. If you left it out the user would not be
able to change the value via the additional button on the basic tab in itool.
We can put together a command line as follows:
_my_command_line = "-a -b " + ${_my_command_b_option} + " -c " +
${_my_command_c_option}
_my_command_line visible_if FALSE
The variable _my_command_line could be used in the following way:
post_config_cmd+="/opt/myapp/bin/command " + ${_my_command_line}
or be placed into the environment for when a script is ran later:
env_vars+="COMMAND_OPTS=" + ${_my_command_line}
Example Seven (regular expression matching)
In the previous example we mentioned that it wasn’t possible to validate a user name:
init _my_command_c_option = "user1"
_my_command_c_option visible_if TRUE
_my_command_c_option help_text "command -c value"
That is true, but it is still possible to perform sanity checking on the value. We can do that with the
help of regular expressions (information on regular expressions is available in the regexp(5)
manual page – Ignite-UX uses extended regular expressions.) We will look at some examples of
what is possible.
143