File tree Expand file tree Collapse file tree 1 file changed +35
-11
lines changed Expand file tree Collapse file tree 1 file changed +35
-11
lines changed Original file line number Diff line number Diff line change @@ -5,18 +5,11 @@ defmodule Mix.CLI do
5
5
Runs Mix according to the command line arguments.
6
6
"""
7
7
def run ( args // System . argv ) do
8
- Mix.Local . append_tasks
9
-
10
- args = load_mixfile ( args )
11
- { task , args } = get_task ( args )
12
-
13
- if Mix.Project . get do
14
- Mix.Task . run "loadpaths" , [ "--no-check" ]
15
- Mix.Task . reenable "loadpaths"
16
- Mix.Task . reenable "deps.loadpaths"
8
+ if help? ( args ) do
9
+ display_banner ( )
10
+ else
11
+ proceed ( args )
17
12
end
18
-
19
- run_task task , args
20
13
end
21
14
22
15
defp load_mixfile ( args ) do
@@ -54,4 +47,35 @@ defmodule Mix.CLI do
54
47
end
55
48
end
56
49
end
50
+
51
+ defp proceed ( args ) do
52
+ Mix.Local . append_tasks
53
+
54
+ args = load_mixfile ( args )
55
+ { task , args } = get_task ( args )
56
+
57
+ if Mix.Project . get do
58
+ Mix.Task . run "loadpaths" , [ "--no-check" ]
59
+ Mix.Task . reenable "loadpaths"
60
+ Mix.Task . reenable "deps.loadpaths"
61
+ end
62
+
63
+ run_task task , args
64
+ end
65
+
66
+ defp display_banner ( ) do
67
+ run_task "help" , [ ]
68
+ end
69
+
70
+ defp help_argument? ( s ) do
71
+ if s do
72
+ String . downcase ( s ) in [ "--help" , "-h" , "-help" ]
73
+ else
74
+ false
75
+ end
76
+ end
77
+
78
+ defp help? ( args ) do
79
+ help_argument? ( Enum . first ( args ) )
80
+ end
57
81
end
You can’t perform that action at this time.
0 commit comments