Sha256: 5740132f0db9df9b082aa2d4e4894ed23c35952d34b82cd8e3d15a65d63e2974

Contents?: true

Size: 753 Bytes

Versions: 3

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

module Hanamimastery
  module CLI
    module Commands
      class ToNotion < 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.4.0 lib/hanamimastery/cli/commands/to_notion.rb
hanamimastery-cli-0.3.1 lib/hanamimastery/cli/commands/to_notion.rb
hanamimastery-cli-0.3.0 lib/hanamimastery/cli/commands/to_notion.rb