Sha256: 33f7460fba851d976cd79406ec92b49664f276cd3b33414d0cb1a160d6b2b53d

Contents?: true

Size: 935 Bytes

Versions: 72

Compression:

Stored size: 935 Bytes

Contents

require 'json'
class KuberKit::UI::Api < KuberKit::UI::Simple
  class Task < KuberKit::UI::Simple::Task
    def print_started
      # do nothing, api formatter should only show result
    end

    def print_finished
      # do nothing, api formatter should only show result
    end
  end

  def create_task_group
    TaskGroup.new(KuberKit::UI::Api::Task)
  end

  def create_task(title, &block)
    task = KuberKit::UI::Api::Task.new(title, &block)
    task.execute
    task.wait
  end

  def print_info(title, text)
    logger.debug(text)
  end

  def print_error(title, text)
    logger.debug(text)
    print_json({error: text})
  end

  def print_warning(title, text)
    logger.debug(text)
  end

  def print_debug(title, text)
    logger.debug(text)
  end

  def print_result(message, data = {})
    print_json({message: message}.merge(data))
  end

  protected
    def print_json(data)
      puts JSON.generate(data)
    end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
kuber_kit-1.3.8 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.7 lib/kuber_kit/ui/api.rb
kuber_kit-1.1.8 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.6 lib/kuber_kit/ui/api.rb
kuber_kit-1.1.7 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.5 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.4 lib/kuber_kit/ui/api.rb
kuber_kit-1.1.6 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.3 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.2 lib/kuber_kit/ui/api.rb
kuber_kit-1.1.5 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.1 lib/kuber_kit/ui/api.rb
kuber_kit-1.3.0 lib/kuber_kit/ui/api.rb
kuber_kit-1.1.4 lib/kuber_kit/ui/api.rb
kuber_kit-1.2.7 lib/kuber_kit/ui/api.rb
kuber_kit-1.2.6 lib/kuber_kit/ui/api.rb
kuber_kit-1.2.5 lib/kuber_kit/ui/api.rb
kuber_kit-1.2.4 lib/kuber_kit/ui/api.rb
kuber_kit-1.2.2 lib/kuber_kit/ui/api.rb
kuber_kit-1.1.2 lib/kuber_kit/ui/api.rb