Sha256: 79defb9c5c7fcfd1be1ae3c8f87ba1a796658d0add757e4a6d10103d953847d9

Contents?: true

Size: 636 Bytes

Versions: 4

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

require "pastel"
require "tty-prompt"

module CobraCommander
  module Output
    # Prints the given CobraCommander::Executor::Context to [output] collection in markdown
    module MarkdownPrinter
      SUCCESS = "\n## ✔ %s\n"
      ERROR = "\n## ✖ %s\n"
      OUTPUT = "\n```\n$ %s\n\n%s\n```\n"

      def self.run(contexts, output)
        contexts.each do |context|
          template = context.success? ? SUCCESS : ERROR

          output.print format(template, context.component_name)
          output.print format(OUTPUT, context.command, context.output)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cobra_commander-0.15.1 lib/cobra_commander/output/markdown_printer.rb
cobra_commander-0.15.0 lib/cobra_commander/output/markdown_printer.rb
cobra_commander-0.14.0 lib/cobra_commander/output/markdown_printer.rb
cobra_commander-0.13.0 lib/cobra_commander/output/markdown_printer.rb