Sha256: 76e72ed294b6d4c3bfe344eba9430ad46cb3382d64d170b96cde2136edf613a3

Contents?: true

Size: 698 Bytes

Versions: 3

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

module ArchivesSpace
  class Client
    module CLI
      extend Dry::CLI::Registry

      def self.client
        cfg = ArchivesSpace::Configuration.new(ArchivesSpace::Client::CLI.find_config)
        ArchivesSpace::Client.new(cfg).login
      end

      def self.find_config
        config = ENV.fetch('ASCLIENT_CFG', File.join(ENV['HOME'], '.asclientrc'))
        raise "Unable to find asclient configuration file at: #{config}" unless File.file?(config)

        JSON.parse(File.read(config), symbolize_names: true)
      end

      register 'exec', Exec, aliases: ['e', '-e']
      register 'version', Version, aliases: ['v', '-v', '--version']
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
archivesspace-client-0.1.12 lib/archivesspace/client/cli.rb
archivesspace-client-0.1.11 lib/archivesspace/client/cli.rb
archivesspace-client-0.1.10 lib/archivesspace/client/cli.rb