File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,7 @@ defmodule ExDoc.CLI do
77 opts = elem ( parsed , 0 )
88 args = elem ( parsed , 1 )
99
10- case args do
11- [ project , version , source_beam ] -> :ok
12- [ _ , _ , _ | _ ] ->
13- IO . puts "Too many arguments.\n "
14- print_usage ( )
15- _ ->
16- IO . puts "Too few arguments.\n "
17- print_usage ( )
18- end
10+ [ project , version , source_beam ] = parse_args ( args )
1911
2012 if formatter = opts [ :formatter ] do
2113 opts = Keyword . put ( opts , :formatter , String . split ( formatter , "." ) )
@@ -25,6 +17,19 @@ defmodule ExDoc.CLI do
2517 ExDoc . generate_docs ( project , version , opts )
2618 end
2719
20+ defp parse_args ( [ _project , _version , _source_beam ] = args ) , do: args
21+ defp parse_args ( [ _ , _ , _ | _ ] ) do
22+ IO . puts "Too many arguments.\n "
23+ print_usage ( )
24+ exit ( 1 )
25+ end
26+ defp parse_args ( _ ) do
27+ IO . puts "Too few arguments.\n "
28+ print_usage ( )
29+ exit ( 1 )
30+ end
31+
32+
2833 defp print_usage do
2934 IO . puts % S """
3035 Usage:
@@ -68,6 +73,5 @@ defmodule ExDoc.CLI do
6873 https://github.com/elixir-lang/dynamo/blob/v1.0/%{path}#L%{line}
6974
7075 """
71- exit( 1 )
7276 end
7377end
You can’t perform that action at this time.
0 commit comments