aboutsummaryrefslogtreecommitdiff
path: root/lib/toglx/escript.ex
blob: a50c5b190fc50d564a010312347c3a39fee76bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

end