Class: Hokaido::CLI
- Inherits:
-
Thor
- Object
- Thor
- Hokaido::CLI
- Defined in:
- lib/hokaido/cli.rb
Instance Method Summary collapse
Instance Method Details
#broadcast(command = ENV['SHELL']) ⇒ Object
14 15 16 |
# File 'lib/hokaido/cli.rb', line 14 def broadcast(command = ENV['SHELL']) Hokaido::Broadcast::Command.run command, *.values_at(:host, :port) end |
#server ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/hokaido/cli.rb', line 19 def server server = Server.run(*.values_at(:host, :port)) rescue Interrupt exit ensure server.terminate if server end |
#version ⇒ Object
42 43 44 |
# File 'lib/hokaido/cli.rb', line 42 def version say Hokaido::VERSION, :cyan end |
#watch ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/hokaido/cli.rb', line 28 def watch server = TCPSocket.open(*.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 |