aboutsummaryrefslogtreecommitdiff
path: root/lib/toglx/escript.ex
blob: a3b68ccc6c362429f032ac409c94152ab5a4b107 (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
defmodule Toglx.Escript do
  use ArgumentParser.Builder.Escript, add_help: false
  @arg [:cmd, required: true, action: :store]
  @arg [:task, action: {:store, :+}]

  def run(%{cmd: "start", task: task}) do
    task
      |> Enum.join(" ")
      |> Toglx.submit_start_event
      |> IO.inspect
  end

  def run(%{cmd: "stop"}) do
    Toglx.submit_stop_event
      |> IO.inspect
  end

  def run(%{cmd: "discard"}) do
    Toglx.submit_discard_event
      |> IO.inspect
  end

  def run(%{cmd: "continue"}) do
    Toglx.submit_continue_event
      |> IO.inspect
  end

end