aboutsummaryrefslogtreecommitdiff
path: root/lib/exgit/escript.ex
blob: b569d645b7d2e2f3fcc6da18dddd52c189bc43ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
defmodule Exgit.Escript do
  @moduledoc """
  Escript entry point for Exgit
  """

  @doc """
  Main entry for Exgit

    iex> main([])
    :error
  """
  @spec main(List.t) :: binary | :error | {:error, binary}
  def main([]) do
    {:error, "Missing Argument"}
  end

  @doc """
  Main entry for Exgit

    iex> main(["test.pack"])
    {:error, "test.pack"}
  """
  def main(args) when is_list(args) do
    args
    |> hd()
    |> parse_packfile()
    |> inspect()
    |> IO.puts
  end

  @doc """
  Parse the provided packfile and display its contents

    iex> parse_packfile("0011223344.pack")
    {:error, "0011223344.pack"}
  """
  @spec parse_packfile(binary) :: {:ok, binary} | {:error, binary}
  def parse_packfile(packfile) do
    {:error, packfile}
  end

end