LUCI Reference Documentation

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


This page describes all the parameters you can use in the description file. There are two categories of parameters: the global parameters, traditionally at the beginning of the description file, and the entry parameters, for each entry.

String values must be enclosed within quotes or double quotes. List values are separated by commas and enclosed between square brackets. Tuple values are separated by commas and enclosed within parenthesis.

Global Parameters

These parameters are global within a given configuration file. The order is not important.

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 environment variables in a shell script).
set entries have the following form:
set keyword value
and comment begins by a #.
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 parameters.
example: config_file_type =  'shell'

entries

presence: optional
type: list of strings
description: List of all entry names in the order they will 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 around the entries in the window, with a title at 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, which is almost identical to the perl format. 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 omitted if you don't use the presence entry parameter. 
Note: you can place the character  r before the string, so the special meaning of the backslashes 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 to 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 replaced by the comment (if the entry is optional), the name and the value of a new entry. 

<comment> should be omitted 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 omit this parameter.

example: the new_entry corresponding to the shell_env type should be defined as follows:

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 optional inactive entry in the configuration file.

If all the parameters are already in the configuration file, then you should omit this parameter.

example: 'description' : 'description of the entry'

 

Entry Parameters

These parameters describe a 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 entry's global parameter to reference the entry, but is mandatory even if you don't use the entry parameter. The order in the list is not important. 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' : 'string_value1',
'entry_parametrer_2' : 'string_value2',
'entry_parametrer_3' : 10
}

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 within 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 character string.
integer an integer with boundaries (parameter integer_limits is required).
filename this provides 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 pops 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: pair of integers
description: Lower and upper bounds for the value for an integer.
example: 'integer_limits'   : (0, 1000)

list_values

presence: mandatory if value_type=list, useless otherwise
type: list of strings OR list of pairs of strings
description: Specify the acceptable values for the entry. You can display alternative strings corresponding to the values by using a list of pairs, 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 parameter to the value 'optional' if you want the corresponding entry to be optional. There will be a checkbox next to the entry name in the LUCI window to enable or disable it. If it is disabled, then it will be changed to a comment in the configuration file.
examples: 'presence'      : 'optional'

Valid HTML 4.0!