Sha256: 135160fac6cf198c6e62825d611f6b290d786ae3da09db735596dace73640e55

Contents?: true

Size: 549 Bytes

Versions: 6

Compression:

Stored size: 549 Bytes

Contents

module Unipept
  class Commands::Config < Cri::CommandRunner
    def run
      abort command.help if arguments.size == 0 || arguments.size > 2

      key, value = *arguments

      if arguments.size == 2
        set_config(key, value)
        puts key + ' was set to ' + value
      else
        puts get_config(key)
      end
    end

    def config
      @config ||= Unipept::Configuration.new
    end

    def set_config(key, value)
      config[key] = value
      config.save
    end

    def get_config(key)
      config[key]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
unipept-1.1.2 lib/commands/unipept/config.rb
unipept-1.1.1 lib/commands/unipept/config.rb
unipept-1.1.0 lib/commands/unipept/config.rb
unipept-1.0.1 lib/commands/unipept/config.rb
unipept-1.0.0 lib/commands/unipept/config.rb
unipept-0.10.0 lib/commands/unipept/config.rb