Sha256: f954cde60f6708eef2ec05fadb9458f4889b66f5ec74ea9febd6aa4e6da152b2
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Uffizzi module UI class Shell attr_accessor :output_format def initialize @shell = Thor::Shell::Basic.new end def say(message) @shell.say(message) end def ask(msg, *args) @shell.ask(msg, *args) end def print_in_columns(messages) @shell.print_in_columns(messages) end def print_table(table_data) @shell.print_table(table_data) end def last_message @shell.send(:stdout).string.strip end def disable_stdout $stdout = StringIO.new end def output(data) $stdout = IO.new(1, 'w') json_format? ? output_in_json(data) : output_in_github_format(data) end private def json_format? output_format == 'json' end def output_in_json(data) say(data.to_json) end def output_in_github_format(data) data.each_key do |key| say("::set-output name=#{key}::#{data[key]}") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uffizzi-cli-0.5.0 | lib/uffizzi/shell.rb |