Sha256: 1dfe912048f6f8b5bf511c43491014341e58567d975339d15f0f5cc6de484742

Contents?: true

Size: 709 Bytes

Versions: 6

Compression:

Stored size: 709 Bytes

Contents

# frozen_string_literal: true

require "sod"

module Milestoner
  module CLI
    module Actions
      module Cache
        # Handles listing users within the cache.
        class List < Sod::Action
          include Import[:logger, :io, client: :cache]

          description "List users."

          on %w[-l --list]

          def call(*)
            logger.info { "Listing users..." }
            client.read(:users, &:all).bind { |users| print users }
          end

          private

          def print users
            return logger.info { "No users found." } if users.empty?

            users.each { |user| io.puts user.to_h.values.join ", " }
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
milestoner-18.4.0 lib/milestoner/cli/actions/cache/list.rb
milestoner-18.3.0 lib/milestoner/cli/actions/cache/list.rb
milestoner-18.2.0 lib/milestoner/cli/actions/cache/list.rb
milestoner-18.1.0 lib/milestoner/cli/actions/cache/list.rb
milestoner-18.0.1 lib/milestoner/cli/actions/cache/list.rb
milestoner-18.0.0 lib/milestoner/cli/actions/cache/list.rb