Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / tools / tryselect / docs / presets.rst
blob6e1008a4565fc6e294d29cd65fbd5fc7b9ea6e87
1 Presets
2 =======
4 Some selectors, such as ``fuzzy`` and ``syntax``, allow saving and loading presets from a file. This is a
5 good way to re-use a selection, either at a later date or by sharing with others. Look for a
6 'preset' section in ``mach <selector> --help`` to determine whether the selector supports this
7 functionality.
9 Using Presets
10 -------------
12 To save a preset, run:
14 .. code-block:: shell
16     $ mach try <selector> --save <name> <args>
18 For example, to save a preset that selects all Windows mochitests:
20 .. code-block:: shell
22     $ mach try fuzzy --save all-windows-mochitests --query "'win 'mochitest"
23     preset saved, run with: --preset=all-windows-mochitests
25 Then run that saved preset like this:
27 .. code-block:: shell
29     $ mach try --preset all-windows-mochitests
31 To see a list of all available presets run:
33 .. code-block:: shell
35     $ mach try --list-presets
38 Editing and Sharing Presets
39 ---------------------------
41 Presets can be defined in one of two places, in your home directory or in a file checked into
42 mozilla-central.
44 Local Presets
45 ~~~~~~~~~~~~~
47 These are defined in your ``$MOZBUILD_STATE_DIR``, typically ``~/.mozbuild/try_presets.yml``.
48 Presets defined here are your own personal collection of presets. You can modify them by running:
50 .. code-block:: shell
52     $ ./mach try --edit-presets
55 Shared Presets
56 ~~~~~~~~~~~~~~
58 You can also check presets into mozilla-central in `tools/tryselect/try_presets.yml`_. These presets
59 will be available to all users of ``mach try``, so please be mindful when editing this file. Make
60 sure the name of the preset is scoped appropriately (i.e doesn't contain any team or module specific
61 terminology). It is good practice to prefix the preset name with the name of the team or module that
62 will get the most use out of it.
65 Preset Format
66 ~~~~~~~~~~~~~
68 Presets are simple key/value objects, with the name as the key and a metadata object as the value.
69 For example, the preset saved above would look something like this in ``try_presets.yml``:
71 .. code-block:: yaml
73     all-windows-mochitests:
74         selector: fuzzy
75         description: >-
76             Runs all windows mochitests.
77         query:
78             - "'win 'mochitest"
80 The ``selector`` key (required) allows ``mach try`` to determine which subcommand to dispatch to.
81 The ``description`` key (optional in user presets but required for shared presets) is a human
82 readable string describing what the preset selects and when to use it. All other values in the
83 preset are forwarded to the specified selector as is.
85 .. _tools/tryselect/try_presets.yml: https://searchfox.org/mozilla-central/source/tools/tryselect/try_presets.yml