Sha256: 58bb1cd875b62dfdf356888dc2eacdc11b382eeabf408e2070e3733415b53321

Contents?: true

Size: 750 Bytes

Versions: 3

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

module Hanamimastery
  module CLI
    module Commands
      class ToPRO < Dry::CLI::Command
        desc 'Renders HTML out of Markdown'
        argument :episode, type: :integer, required: :true, desc: "Episode's ID to render"
        option :save, aliases: ['-s'], type: :boolean, default: false, desc: 'Save to file?'

        include Deps[
          repository: 'repositories.episodes',
          transformation: 'transformations.to_pro'
        ]

        def call(episode:, save:, **)
          content = repository.fetch(episode).content
          processed = transformation.call(content)
          save ? File.write("#{episode}-episode.html", processed) : puts(processed)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hanamimastery-cli-0.2.2 lib/hanamimastery/cli/commands/to_pro.rb
hanamimastery-cli-0.2.1 lib/hanamimastery/cli/commands/to_pro.rb
hanamimastery-cli-0.2.0 lib/hanamimastery/cli/commands/to_pro.rb