@@ -5,18 +5,22 @@ defmodule Mix.CLI do
5
5
Runs Mix according to the command line arguments.
6
6
"""
7
7
def main ( args \\ System . argv ( ) ) do
8
+ if env_variable_activated? ( "MIX_DEBUG" ) do
9
+ IO . puts ( "-> Running mix CLI" )
10
+ { time , res } = :timer . tc ( & main / 2 , [ args , true ] )
11
+ IO . puts ( [ "<- Ran mix CLI in " , Integer . to_string ( div ( time , 1000 ) ) , "ms" ] )
12
+ res
13
+ else
14
+ main ( args , false )
15
+ end
16
+ end
17
+
18
+ defp main ( args , debug? ) do
8
19
Mix . start ( )
9
20
21
+ if debug? , do: Mix . debug ( true )
10
22
if env_variable_activated? ( "MIX_QUIET" ) , do: Mix . shell ( Mix.Shell.Quiet )
11
23
12
- debug? =
13
- if env_variable_activated? ( "MIX_DEBUG" ) do
14
- Mix . debug ( true )
15
- true
16
- else
17
- false
18
- end
19
-
20
24
if profile = System . get_env ( "MIX_PROFILE" ) do
21
25
Mix.State . put ( :profile , String . split ( profile , "," ) )
22
26
end
@@ -29,13 +33,6 @@ defmodule Mix.CLI do
29
33
:version ->
30
34
display_version ( )
31
35
32
- nil when debug? ->
33
- shell = Mix . shell ( )
34
- shell . info ( "-> Running mix CLI" )
35
- { time , res } = :timer . tc ( & proceed / 1 , [ args ] )
36
- shell . info ( [ "<- Ran mix CLI in " , Integer . to_string ( div ( time , 1000 ) ) , "ms" ] )
37
- res
38
-
39
36
nil ->
40
37
proceed ( args )
41
38
end
0 commit comments