Skip to content

Commit 7f33e44

Browse files
committed
refactor: ♻️ refactor main
1 parent 09574b2 commit 7f33e44

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/main.ex

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ defmodule InterpolationApp.Main do
1212
System.halt()
1313
end
1414

15-
argv =
16-
Enum.map(args, fn arg -> String.split(arg, "--") end)
17-
|> List.flatten()
18-
|> Enum.filter(fn s -> s != "" end)
19-
20-
case ConfigParser.parse_args(argv) do
15+
case ConfigParser.parse_args(extract_args(args)) do
2116
{:ok, config} ->
2217
Repl.start(config)
2318

@@ -28,6 +23,13 @@ defmodule InterpolationApp.Main do
2823
end
2924
end
3025

26+
defp extract_args(args) do
27+
args
28+
|> Enum.map(fn arg -> String.split(arg, "--") end)
29+
|> List.flatten()
30+
|> Enum.filter(fn s -> s != "" end)
31+
end
32+
3133
defp help do
3234
"""
3335
usage: interpolation-app [options] --methods=<method1,method2,...> --step=<step>

0 commit comments

Comments
 (0)