.. _mach_settings: ======== Settings ======== Mach can read settings in from a set of configuration files. These configuration files are either named ``machrc`` or ``.machrc`` and are specified by the bootstrap script. In mozilla-central, these files can live in ``~/.mozbuild`` and/or ``topsrcdir``. Settings can be specified anywhere, and used both by mach core or individual commands. Core Settings ============= These settings are implemented by mach core. * alias - Create a command alias. This is useful if you want to alias a command to something else, optionally including some defaults. It can either be used to create an entire new command, or provide defaults for an existing one. For example: .. parsed-literal:: [alias] mochitest = mochitest -f browser browser-test = mochitest -f browser Defining Settings ================= Settings need to be explicitly defined, along with their type, otherwise mach will throw when trying to access them. To define settings, use the :func:`~decorators.SettingsProvider` decorator in an existing mach command module. E.g: .. code-block:: python from mach.decorators import SettingsProvider from mozbuild.base import MachCommandBase @SettingsProvider class ArbitraryClassName(MachCommandBase): config_settings = [ ('foo.bar', 'string', "A helpful description"), ('foo.baz', 'int', "Another description", 0, {'choices': set([0,1,2])}), ] ``@SettingsProvider``'s must specify a variable called ``config_settings`` that returns a list of tuples. Alternatively, it can specify a function called ``config_settings`` that returns a list of tuples. Each tuple is of the form: .. code-block:: python ('
.