The configuration system

Devparrot use a configuration system to store all kind of options. Those options are used either by the devparrot core, commands or modules.

Options may be regroup into sections. And each section may be regroup into another sections.

If you want to set a config option, you can use the config command:

config optionName optionValue

If you want to get a config option value, you can use the config macro

aCommand %config(optionName)

On top of that, each option may also be specialized depending of the context.

For example, there is the option "auto_indent". When this option is active, Devparrot automatically add the indentation level of a new line to the same indentation level of the previous line when you press <Enter>

You may want to have this option deactivated by default but active for Python file. Hopefully, Devparrot, use the type of the file edited to get the specialised value of the option. So you can configure :

config auto_indent False
config auto_indent True Python

The config system use a list of keys to specialize options. Other keys used are composed from the path of the file. This allow some kind of loose project specialisation.

Alas, the config command and macro do not handle it.

The configuration file

Reconfiguring Devparrot at startup can be pretty borring. There is a well known solution : the configuration file.

The default configuration file Devparrot use is ~/.devparrotrc

This is a simple python script. You can use any python module, create function and so.

Once the script is executed, all global variable not starting by '_' will be handle as configuration value.

For example:

import os as _os # we rename the module to make is starts with a '_'
# This way, it will be not handle by Devparrot as a config entry name.
window_height = 600
auto_indent = True
if _os.getlogin() == "me":
    show_line_numbers = False

You cannot define any option you want. The option must be 'registred' before.

If you declare a option entry Devparrot doesn't know about, a error message will be displayed.

Spectialized option

To specialise of a option value, you must use a dict:

auto_index = {None     : False,
              'Python' : True}