@@ -152,6 +152,24 @@ defmodule Mix do
152152 with extra clean up logic.
153153
154154 Note aliases do not show up on `mix help`.
155+
156+ ## Environment variables
157+
158+ Environment variables can be used to modify Mix behaviour.
159+
160+ Mix responds to the following variables:
161+
162+ * `MIX_ARCHIVE` - allows specifying the directory into which the archives should be installed
163+ * `MIX_DEBUG` - outputs debug information about each task before running it
164+ * `MIX_ENV` - allows specifying which environment should be used. see Environments
165+ * `MIX_EXS` - allows changing the full path to the `mix.exs` file
166+ * `MIX_HOME` - stores configuration files and scripts shared by multiple implementations
167+ * `MIX_PATH` - allows expanding the code path
168+ * `MIX_QUIET` - does not print information messages to the terminal
169+
170+ Variables which do not take a value should be set to either `1` or `true`, for example:
171+
172+ $ MIX_DEBUG=1 mix compile
155173 """
156174
157175 use Application
@@ -234,6 +252,20 @@ defmodule Mix do
234252 Mix.State . put ( :shell , shell )
235253 end
236254
255+ @ doc """
256+ Returns true if Mix is in debug mode.
257+ """
258+ def debug? do
259+ Mix.State . get ( :debug , false )
260+ end
261+
262+ @ doc """
263+ Sets Mix debug mode.
264+ """
265+ def debug ( debug ) when is_boolean ( debug ) do
266+ Mix.State . put ( :debug , debug )
267+ end
268+
237269 @ doc """
238270 Raises a Mix error that is nicely formatted.
239271 """
0 commit comments