Sha256: 589156b0ff12ae4c2554f7fbc3dd776a600bfa95f66337cc730f32c09414765a
Contents?: true
Size: 857 Bytes
Versions: 29
Compression:
Stored size: 857 Bytes
Contents
require "magellan/cli/messaging" module Magellan module Cli module Messaging class Mqtt < Magellan::Cli::Messaging::Base desc "pub TOPIC PAYLOAD", I18n.t(:pub, scope: [:messaging, :mqtt]) def pub(topic, payload) core.publish(topic, try_reading_file(payload).dup) log_success "\e[32mOK\e[0m" rescue Magellan::Cli::Error raise rescue => e show_error_and_exit1(e) end desc "get [TOPIC]", I18n.t(:get, scope: [:messaging, :mqtt]) def get(topic = nil) topic, payload = *core.get_message(topic) $stderr.puts topic $stdout.puts payload.ascii_only? ? payload : payload.inspect rescue Magellan::Cli::Error raise rescue => e show_error_and_exit1(e) end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems