class Hokaido::CLI

Public Instance Methods

broadcast(command = ENV['SHELL']) click to toggle source
# File lib/hokaido/cli.rb, line 14
def broadcast(command = ENV['SHELL'])
  Hokaido::Broadcast::Command.run command, *options.values_at(:host, :port)
end
server() click to toggle source
# File lib/hokaido/cli.rb, line 19
def server
  server = Server.run(*options.values_at(:host, :port))
rescue Interrupt
  exit
ensure
  server.terminate if server
end
version() click to toggle source
# File lib/hokaido/cli.rb, line 42
def version
  say Hokaido::VERSION, :cyan
end
watch() click to toggle source
# File lib/hokaido/cli.rb, line 28
def watch
  server = TCPSocket.open(*options.values_at(:host, :port))
  server.puts 'watch'

  while chunk = server.readpartial(4096)
    $stdout.write chunk
  end
rescue Interrupt, EOFError, Errno::EIO
  # do nothing
ensure
  server.close if server
end