Sha256: 54668e43f4f2ccbfe4c27cab3dc15d802c22dfcaeea5536d7e6aa123e1eb0ccf

Contents?: true

Size: 680 Bytes

Versions: 13

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

require "sod"

module Milestoner
  module CLI
    module Actions
      module Cache
        # Handles deleting a user from the cache.
        class Delete < Sod::Action
          include Import[:logger, client: :cache]

          description "Delete user."

          on %w[-d --delete], argument: "NAME"

          def call name
            client.write(:users) { delete name }
                  .either(method(:success), method(:failure))
          end

          private

          def success(user) = logger.info { "Deleted: #{user.name.inspect}." }

          def failure(message) = logger.abort message
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
milestoner-18.11.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.10.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.9.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.8.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.7.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.6.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.5.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.4.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.3.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.2.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.1.0 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.0.1 lib/milestoner/cli/actions/cache/delete.rb
milestoner-18.0.0 lib/milestoner/cli/actions/cache/delete.rb