Sha256: b7839533137318c43a8a36c81d52168da9d96cdeb2bdf1237638e9fdfba9ccf2

Contents?: true

Size: 698 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
archivesspace-client-0.4.1 lib/archivesspace/client/cli.rb
archivesspace-client-0.4.0 lib/archivesspace/client/cli.rb
archivesspace-client-0.3.0 lib/archivesspace/client/cli.rb
archivesspace-client-0.2.0 lib/archivesspace/client/cli.rb