aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkballou <kballou@devnulllabs.io>2016-06-21 11:54:01 -0600
committerkballou <kballou@devnulllabs.io>2016-06-21 11:54:01 -0600
commite2e85299bcae58cdf9c6039824a89d0cca0f65ae (patch)
tree96d18779e3cda40b0b892fd10ca52b7e3a1fb389
parent77e4e8647d565218bfc72fbe569eb7eb00c4d8e6 (diff)
downloadtoglx-e2e85299bcae58cdf9c6039824a89d0cca0f65ae.tar.gz
toglx-e2e85299bcae58cdf9c6039824a89d0cca0f65ae.tar.xz
Add continue command to continue last entry
This will only start a new entry if there is currently no running/tracking entry.
-rw-r--r--lib/toglx.ex11
-rw-r--r--lib/toglx/escript.ex5
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/toglx.ex b/lib/toglx.ex
index 9bb086c..63bbcdd 100644
--- a/lib/toglx.ex
+++ b/lib/toglx.ex
@@ -33,6 +33,17 @@ defmodule Toglx do
end
end
+ def submit_continue_event do
+ case current do
+ %{data: nil} -> list |> List.last |> continue
+ _ -> :ok
+ end
+ end
+
+ defp continue(%{description: task_name}) do
+ submit_start_event(task_name)
+ end
+
def current do
create_togglex_client
|> Togglex.Api.TimeEntries.current
diff --git a/lib/toglx/escript.ex b/lib/toglx/escript.ex
index a50c5b1..a3b68cc 100644
--- a/lib/toglx/escript.ex
+++ b/lib/toglx/escript.ex
@@ -20,4 +20,9 @@ defmodule Toglx.Escript do
|> IO.inspect
end
+ def run(%{cmd: "continue"}) do
+ Toglx.submit_continue_event
+ |> IO.inspect
+ end
+
end