Sha256: 698eae3b1e264a44982e80f0d3ab35c332af98fc0142e0de0ebe0b0c905b79ab

Contents?: true

Size: 851 Bytes

Versions: 7

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

require 'time'

module Hanamimastery
  module CLI
    module Commands
      class Touch < Dry::CLI::Command
        desc 'Updates the modifiedAt with the current date'
        argument :episode, type: :integer, required: :true, desc: "Episode's ID to touch"
        option :timestamp, type: :string, default: Time.now.to_s, desc: 'Override modified time'

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

        def call(episode:, timestamp:, **)
          timestamp = Time.parse(timestamp)
          content = repository.read(episode)
          processed =
            transformation.call(
              content, timestamp: timestamp
            )
          repository.replace(episode, processed)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hanamimastery-cli-0.4.0 lib/hanamimastery/cli/commands/touch.rb
hanamimastery-cli-0.3.1 lib/hanamimastery/cli/commands/touch.rb
hanamimastery-cli-0.3.0 lib/hanamimastery/cli/commands/touch.rb
hanamimastery-cli-0.2.2 lib/hanamimastery/cli/commands/touch.rb
hanamimastery-cli-0.2.1 lib/hanamimastery/cli/commands/touch.rb
hanamimastery-cli-0.2.0 lib/hanamimastery/cli/commands/touch.rb
hanamimastery-cli-0.1.0 lib/hanamimastery/cli/commands/touch.rb