Debian Codegraph @

python/mach/docs/usage.rst

raw
1 .. _mach_usage:
2
3 ==========
4 User Guide
5 ==========
6
7 Mach is the central entry point for most operations that can be performed in
8 mozilla-central.
9
10
11 Command Help
12 ------------
13
14 To see an overview of all the available commands, run:
15
16 .. code-block:: shell
17
18 $ ./mach help
19
20 For more detailed information on a specific command, run:
21
22 .. code-block:: shell
23
24 $ ./mach help <command>
25
26 If a command has subcommands listed, you can see more details on the subcommand
27 by running:
28
29 .. code-block:: shell
30
31 $ ./mach help <command> <subcommand>
32
33 Alternatively, you can pass ``-h/--help``. For example, all of the
34 following are valid:
35
36 .. code-block:: shell
37
38 $ ./mach help try
39 $ ./mach help try fuzzy
40 $ ./mach try -h
41 $ ./mach try fuzzy --help
42
43
44 Tab Completion
45 --------------
46
47 There are commands built-in to ``mach`` that can generate a fast tab completion
48 script for various shells. Supported shells are currently ``bash``, ``zsh`` and
49 ``fish``. These generated scripts will slowly become out of date over time, so
50 you may want to create a cron task to periodically re-generate them.
51
52 See below for installation instructions:
53
54 Bash
55 ~~~~
56
57 .. code-block:: shell
58
59 $ mach mach-completion bash -f _mach
60 $ sudo mv _mach /etc/bash_completion.d
61
62 Bash (homebrew)
63 ~~~~~~~~~~~~~~~
64
65 .. code-block:: shell
66
67 $ mach mach-completion bash -f $(brew --prefix)/etc/bash_completion.d/mach.bash-completion
68
69 Zsh
70 ~~~
71
72 .. code-block:: shell
73
74 $ mkdir ~/.zfunc
75 $ mach mach-completion zsh -f ~/.zfunc/_mach
76
77 then edit ~/.zshrc and add:
78
79 .. code-block:: shell
80
81 fpath+=~/.zfunc
82 autoload -U compinit && compinit
83
84 You can use any directory of your choosing.
85
86 Zsh (oh-my-zsh)
87 ~~~~~~~~~~~~~~~
88
89 .. code-block:: shell
90
91 $ mkdir $ZSH/plugins/mach
92 $ mach mach-completion zsh -f $ZSH/plugins/mach/_mach
93
94 then edit ~/.zshrc and add 'mach' to your enabled plugins:
95
96 .. code-block:: shell
97
98 plugins(mach ...)
99
100 Zsh (prezto)
101 ~~~~~~~~~~~~
102
103 .. code-block:: shell
104
105 $ mach mach-completion zsh -f ~/.zprezto/modules/completion/external/src/_mach
106
107 Fish
108 ~~~~
109
110 .. code-block:: shell
111
112 $ ./mach mach-completion fish -f ~/.config/fish/completions/mach.fish
113
114 Fish (homebrew)
115 ~~~~~~~~~~~~~~~
116
117 .. code-block:: shell
118
119 $ ./mach mach-completion fish -f (brew --prefix)/share/fish/vendor_completions.d/mach.fish
120
121
122 User Settings
123 -------------
124
125 Some mach commands can read configuration from a ``machrc`` file. The default
126 location for this file is ``~/.mozbuild/machrc`` (you'll need to create it).
127 This can also be set to a different location by setting the ``MACHRC``
128 environment variable.
129
130 For a list of all the available settings, run:
131
132 .. code-block:: shell
133
134 $ ./mach settings
135
136 The settings file follows the ``ini`` format, e.g:
137
138 .. code-block:: ini
139
140 [alias]
141 eslint = lint -l eslint
142
143 [build]
144 telemetry = true
145
146 [try]
147 default = fuzzy
148
149
150 .. _bash completion: https://searchfox.org/mozilla-central/source/python/mach/bash-completion.sh