44 lines
772 B
Ruby
Executable File
44 lines
772 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
require_relative '../lib/wzombi/config'
|
|
require_relative '../lib/wzombi/server'
|
|
require_relative '../lib/wzombi/command_store'
|
|
|
|
base = File.expand_path("..", __dir__)
|
|
config = WZombi::Config.new(base_path: base)
|
|
|
|
def help
|
|
puts <<~HELP
|
|
Uso:
|
|
w-zombi start
|
|
w-zombi cmd "<comando>"
|
|
w-zombi ayuda | -h | -help
|
|
|
|
Ejemplo ADN:
|
|
adn tools w-zombi cmd "ipconfig"
|
|
HELP
|
|
end
|
|
|
|
cmd = ARGV[0]
|
|
|
|
case cmd
|
|
when "start"
|
|
WZombi::Server.new(config).start
|
|
|
|
when "cmd"
|
|
command = ARGV[1]
|
|
if command.nil?
|
|
puts "Falta comando"
|
|
exit
|
|
end
|
|
store = WZombi::CommandStore.new(config.cmd_path)
|
|
store.update(command)
|
|
puts "Comando actualizado: #{command}"
|
|
|
|
when "ayuda", "-h", "-help", nil
|
|
help
|
|
|
|
else
|
|
puts "Comando desconocido"
|
|
help
|
|
end
|