LUCI Reference Documentation

[main]     [download]    [tutorial]     [examples]




This page describes all the parameters you can use in the description file. There is two catagories of parameters: the global parameters, traditionnally at the beginning of the description file, and the entry parameters, for each entry.
String values must be enclosed between quotes ou double quotes. List values are separated by commas and enclosed between square brackets. Tuple values are separated by commas and enclosed between parenthesis.
 
 

Global Parameters

This parameters are global for a given configuration file. The order has no importance.
 

config_file_name

presence: mandatory
type: string
description: Name of the configuration file to edit.
example: config_file_name =  '/etc/config.file'

config_file_type

presence: mandatory
type: string
description: Type of the configuration file to edit.
Type can be one of the following:
 
shell entries have the following form: 
keyword=value
and comment begins by a # (like in a shell script).
shell_env entries have the following form: 
export keyword=value
and comment begins by a # (use it to edit environement variables in a shell script).
keywords entries have the following form: 
keyword  value
and comment begins by a #.
custom Use this type if you want to describe the configuration file, using the pattern, comment and new_entry global prameters.
example: config_file_type =  '/etc/config.file'

entries

presence: optional
type: list of strings
description: List of all the entries names in the order their appear in the window. If you omit this parameter, they will appear in alphabetic order (at least with python 1.5.2)
example: entries=['entry1', 'entry2', 'entry3', 'entry4']

title

presence: optional
type: string
description: Print a frame arround the entries in the window, with a title on the top. If you just want the frame, set the title as a null string.
example: title='Example of configuration'

pattern

presence: mandatory if config_file_type is custom
type: string
description: Specify a regular expression describing an entry line in the configuration file. This regular expression uses the format of the re Python module, wich is almost identical to the perl one. Read the excellent Python Regular Expression HOWTO by A.M. Kuchling if you want to learn more about how to write your own. 
This regular expression must contains 3 named groups: <comment>, <variable> and <value>. <comment> should match the comment in an entry, <variable> the name of the entry and <value> its value. 
<comment> should be ommited if you don't use the presence entry parameter. 
Note: you can place a  r before the string, so the special meaning of the backslashs are ignored.
example: the pattern corresponding to the shell_env type should be defined as follow (on one line):
pattern=r'\s*(?P<comment>#?)\s*export\s+(?P<variable>\b\w+\b)=
         (?P<value>\S*(?:\s*[^\s#]+)*)(?:\s*)|(?:\s+#.*)$'

new_entry

presence: mandatory if config_file_type is custom and you want LUCI to add new entries in the configuration file.
type: string
description: Specify how to write a new entry in the configuration file. It must contains the strings <comment>, <name> and <value>. They will be remplaced by the comment (if the entry is optional), the name and the value of a new entry. 
<comment> should be ommited if you don't use the presence entry parameter.
The string should end with a newline (\n).
If all the parameters are already in the configuration file, then you should ommit this parameter.
example: the new_entry corresponding to the shell_env type should be defined as follow:
new_entry='<comment>export <name>=<value>\n'

comment

presence: mandatory if config_file_type is custom and you want LUCI to add entries with the presence entry parameter
type: string
description: Specify what string to use as a comment when LUCI add a optionnal inactive entry in the configuration file.
If all the parameters are already in the configuration file, then you should ommit this parameter.
example: the new_entry corresponding to the shell_env type should be defined as follow:
new_entry='<comment>export <name>=<value>\n'

 

Entry Parameters

This parameters describe an given entry. They appear in a list corresponding to the entry. The name of the list must be unique, and cannot begin with an underscore. It is only used by the entries global parameter to reference the entry, but is mandatory even if you don't use the entries parameter. The order in the list has no importance. Parameter names must be enclosed between quotes or double quotes. Parameter names and values are separated by colons.
Example of an entry definition:
 
entry1={
'entry_parametrer_1' : 'value1',
'entry_parametrer_2' : 'value2',
'entry_parametrer_3' : 'value3'
}

name

presence: mandatory
type: string
description: Name of the entry as it appears in the window.
example: 'name' : 'an entry'

config_name

presence: mandatory
type: string
description: Name of the entry in the configuration file.
example: 'config_name' : 'ENTRY'

value_type

presence: optional (type string by default)
type: string
description: Type of the entry. The types are:
 
string any characters string.
integer an integer with boundaries (parameter integer_limits is required).
filename this one will provide a string entry with a browse button connected to a file selection box.
list a list of items (parameter list_values is required).
example: 'value_type' : 'filename'

description

presence: optional
type: string
description: Short description of the entry. It will appear as a tooltip (little text string that pop up when you leave the mouse cursor on the entry)
example: 'description' : 'this is a short description of this entry'

max_length

presence: optional
type: integer
description: Maximum length of the value in this entry (in characters)
example: 'max_length'   : 20

size

presence: optional
type: integer
description: Length (in pixels) of the entry in the window.
example: 'size'   : 110

integer_limits

presence: mandatory if value_type=integer, useless otherwise
type: couple of integer
description: Boundaries of the value for the integer.
example: 'integer_limits'   : (0, 1000)

list_values

presence: mandatory if value_type=list, useless otherwise
type: list of strings OR list of couples of strings
description: Specifie the accetable values for the entry. You can display alternative strings corresponding to the values by using a list of couples, where the first string will be displayed in the window, and the second string will be written in the configuration file (see the second example below).
examples: 'list_values'   : ['item1', 'item2', 'item3']
'list_values'   : [('Yes', '1'), ('No', '0')]

presence

presence: optional
type: string
description: Set this paramater to the value 'optional' if you want the corresponding entry to be optional. There will be a checkbox close to the entry name in the LUCI window to active or disactive it. If it is inactive, then it will be commented in the configuration file.
examples: 'presence'      : 'optional'