aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/cli
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-09-11 17:21:14 +0200
committerAlex Auvolat <alex@adnab.me>2018-09-11 17:21:14 +0200
commit9695231c327e052c5d5bc61197cc8222599fb91a (patch)
treec0d0f247269729658ad354a32475f34fa7268ed1 /shard/lib/cli
parenta033c82a3c656a8f53feb60b5b149680771ac247 (diff)
downloadshard-9695231c327e052c5d5bc61197cc8222599fb91a.tar.gz
shard-9695231c327e052c5d5bc61197cc8222599fb91a.zip
Block store dependency management & caching (NOT TESTED)
Diffstat (limited to 'shard/lib/cli')
-rw-r--r--shard/lib/cli/cli.ex18
1 files changed, 13 insertions, 5 deletions
diff --git a/shard/lib/cli/cli.ex b/shard/lib/cli/cli.ex
index c3afe8f..bf3a555 100644
--- a/shard/lib/cli/cli.ex
+++ b/shard/lib/cli/cli.ex
@@ -4,6 +4,10 @@ defmodule SCLI do
"""
def run() do
+ for {_chid, _manifest, chpid} <- Shard.Manager.list_shards do
+ GenServer.cast(chpid, {:subscribe, self()})
+ end
+
run(nil)
end
@@ -64,11 +68,15 @@ defmodule SCLI do
end
defp handle_command(pid, ["hist"]) do
- GenServer.call(pid, {:read_history, nil, 25})
- |> Enum.each(fn {{ts, nick, msg}, true} ->
- IO.puts "#{ts |> DateTime.from_unix! |> DateTime.to_iso8601} <#{nick}> #{msg}"
- end)
- pid
+ if pid == nil do
+ IO.puts "Not currently on a channel!"
+ else
+ GenServer.call(pid, {:read_history, nil, 25})
+ |> Enum.each(fn {{ts, nick, msg}, true} ->
+ IO.puts "#{ts |> DateTime.from_unix! |> DateTime.to_iso8601} <#{nick}> #{msg}"
+ end)
+ pid
+ end
end
defp handle_command(_pid, ["join", qchan]) do